Reputation: 2776
I currently have Redis as a LRU cache. I want to keep this, but I also have some things I'm going to store in cache that are called often but are only valid for small amounts of time.
Can I use both?
So if I don't put a expiry on some keys, they will be evicted via the LRU algorithm, but will keys I set a expire on expire individually? Or do I have to deploy another redis database?
Upvotes: 0
Views: 537
Reputation: 49962
No - you'll want to separate these to two independent instances, which is a good choice regardless.
Redis' eviction policy is determined by the maxmemory-policy
configuration directive. It has two main "flavors" - all keys or volatile (i.e. with TTL) only. Since there is no eviction flavor for non-volatile keys only, you'll need to keep the current LRU cache instance with its all-*
eviction policy and have another instance with maxmemory-policy=none
for your TTLed keys.
Upvotes: 1