extract redis connection to a method