I want to use gem "redis-store"
as cache store in my Rails app. Unlike memcached redis doesn't cleanup unused keys, but I can use EXPIRE
command on each key (via :expire_in
option) to limit lifetime of each key.
Then I want use cache_key
of my model (which includes id
and updated_at
) as part of redis key, used for caching. So when model will be updated, new cache key will be created, and old one will never be used.
So the question is, which expiration time to choose? If set too small, it eliminates benefits from caching, if too long - it fills redis with unused data, which can (probably) reduce performance. Where is golden mean?