colinmollenhour / Cm_Cache_Backend_Redis

A Zend_Cache backend for Redis with full support for tags (works great with Magento)
Other
387 stars 143 forks source link

Support fixing lifetime of specific keys #77

Closed melvyn-sopacua closed 10 years ago

melvyn-sopacua commented 10 years ago

Some FPC implementations call Zend_Cache_Backend::save without lifetime, effectively setting non-volatile keys. Most notably Magento EE FPC does this. When a cache store has a finite size, Redis is typically set to a volatile eviction method and should be for Magento, as some keys cannot be cleaned out or result in crucial configuration information to be lost. In extreme cases this can cause the 100-router iteration bug.

Typically, the FPC pages take up the bulk of the cache store. When Redis cannot evict these FPC keys, you will at some point end up with a completely non-volatile set of keys, effectively preventing new information from entering the cache.

This commit introductes 3 settings that allow the administrator to have the Redis cache backend fixup the lifetime of keys matching a regular expression, preventing overload of the Redis store with non-volatile keys.

colinmollenhour commented 10 years ago

The backend really is not the place to solve application issues. Magento should be fixed to allow configurable expirations, expiration with jitter, increasing expiration based on hits, etc.. However, if your cache cannot hold the entire dataset then you will still potentially have issues. Also, you should absolutely be running the FPC in a separate instance of Redis from the core cache and sessions.

coresh commented 10 years ago

Thanks for quick response