Refactoring Cache management