Refactoring Cache management.