The in-memory cache introduced in 2.5-rc2 in EZP-29659 clears cache when reaching limit of items by FIFO (First In First Out) approach*.
However as cache will be added for more objects, and/or also for larger installs the default limit of 100 items will be reached rather fast.
Effect will be that cache items that are very often requested (especially languages and content types) will be evicted from the cache and will be needed to be re-fetched much more often then needed.
There are two parallel options that can help tune this:
- Increase the limit from current default of 100 items
- Implement LFU (Last Frequently Used) approach* for cache replacement
The latter will be most efficient as it's about keeping track of how often cache items are requested, and on need to evict ("vacuum") cache items delete least frequently used cache items first.
NOTE: The reason why LFU and not LRU is proposed is that in-memory cache by design is meant to be short lived, so we don't risk that the LFU tracking need to take into account if cache items where for a short while in great demand but no longer needed, expiry will take care of that.