2

I noticed that Magento Layout module does not provide TTL when saves to cache, so the keys in Redis are not expired.

Example: vendor/magento/framework/View/Layout.php:

$this->cache->save($this->serializer->serialize($data), $cacheId, $this->getUpdate()->getHandles());

Taking into account the key hash depends on the entity ID (i.e. product/category/page) the cache is bloated with key that will never be evicted.

It all leads to 5GB - 6GB of the cache size by the end of the day.

Can anyone tell what was the reason to implement it like this, and should it be changed?

  • For anyone looking for a solution: You can instruct the Redis backend to automatically add EXPIRE by adding these lines to app/etc/env.php 'auto_expire_lifetime' => 3600, 'auto_expire_pattern' => '/STRUCTURE_LAYOUT_FRONTEND/', // regexp for keys to auto expire – Александр Егоров Oct 19 '18 at 12:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.