refactoring for redis  utilization