TagsBundle
TagsBundle copied to clipboard
Missing expire/TTL on Redis keys
When inspecting Redis keys from this bundle they're missing expiration/TTL:
$ redis-cli -n 1
> TTL namespace:tag-content-15681
(integer) -1
To avoid maxing out Redis memory with the "volatile-lru" eviction strategy one can define a "default_lifetime" in app/config/cache_pool/cache.redis.yml
.
services:
cache.redis:
class: Symfony\Component\Cache\Adapter\TagAware\RedisTagAwareAdapter
parent: cache.adapter.redis
tags:
- name: cache.pool
clearer: cache.app_clearer
provider: 'redis://%cache_dsn%?timeout=5&read_timeout=10'
namespace: '%cache_namespace%'
default_lifetime: 36000 # 10 hours
volatile-lru states that:
evict keys by trying to remove the less recently used (LRU) keys first, but only among keys that have an expire set, in order to make space for the new data added.
Expected behaviour would be that cache items are given a TTL when defined in Symfony.
Would be great to have some feedback on this. We could possibly provide a PR.