DRY up redis code