Refactoring for cache key consistency