I currently i used the same redis instance to save 2 types of informations:
My question is if there is a way to separate between those 2 kinds of data in a manner that enable to define LRU only on the data of type 1 , but not on the data of type 2.
For the first type of data, you can set a timeout i.e. TTL, for each key (with EXPIRE
, EXPIREAT
, or SET
command), and for the second type of data, set no timeout. Then you can config your Redis server to set maxmemory-policy
as volatile-lru.
With this setting, only the first type of data will be evicted with LRU algorithm.