Refactor redis initialization