Doug Smith
Doug Smith

Reputation: 29326

With Redis set to allkeys-lfu eviction, can I specify that a specific key should NEVER be evicted?

I'm using Redis with a allkeys-lfu set in configuration for eviction.

However there's one key that I want to make sure is never evicted, can I manually set a "protect" on that key so it will never be evicted under any circumstance, even if it's almost never used?

Upvotes: 0

Views: 625

Answers (1)

Itamar Haber
Itamar Haber

Reputation: 50112

Nope, you'll need to solve this by setting the policy to one of the volatile-* policies, and set an arbitrarily large TTL on all keys except the one you want "protected".

That said, most often than not, it is simpler to use two dedicated databases, each configured per the requirements for the dataset that it stores.

Upvotes: 1

Related Questions