Cache refactoring