Belf
Belf

Reputation: 47

Custom Eviction Policy in Redis

I have been reading and searching for Java-based Redis Clients and OMs that allow one to communicate with Redis Server. So far, I have understood that we can only set one of the predefined eviction policies and the Redis server handles the eviction process. I want to use a custom Eviction Policy in Redis, besides for example LRU and LFU. Is there a way can I inject my policy?

Upvotes: 1

Views: 477

Answers (1)

Simon Prickett
Simon Prickett

Reputation: 4148

Custom eviction policies can't be set at the database level, Redis supports a few eviction policies that can be configured in the server's config file: https://redis.io/docs/reference/eviction/

If you wanted something custom you'd need to develop this in your application and have it manage the keyspace accordingly. If you needed to monitor memory usage on the Redis server from your application, you could use the INFO (https://redis.io/commands/info/) and MEMORY USAGE (https://redis.io/commands/memory-usage/) commands for example.

Upvotes: 1

Related Questions