First of all, let me say I love Redis! And I am really sorry if there is an obvious solution I missed.

The problem/use-case that the feature addresses

I want to run some maintenance on my Redis instance, that has a LRU eviction policy and a max memory limit. The idea is to loop over the keys, get the values length with strlen, and evict the keys whose values have the biggest lengths. The issue: commands like get and strlen reset the idletime, which is not great regarding the eviction policy.

Description of the feature

I would like a way to have a way to run get/strlen commands without updating the idletime. Also, perhaps something similar for "freq" when on LFU policy.

Alternatives you've considered

I don't think it is possible to manually set the idletime, but if I am wrong, then I could store the idletime before doing the get, then restore it after.

Additional information

I will use Python with redis-py to implement this.

Comment From: madolson

I suppose the exact solution you want is adding some argument onto STRLEN, but a more generic solution might be to add a new argument on GET to have the notouch configuration. Would that solve your use case?

Comment From: alexprengere

Exactly! Though for my precise use case, STRLEN would suffice, I can see my maintenance scripts evolve to a point where I will need GET as well. And I guess it would serve more use cases for other users.

Comment From: itamarhaber

Speaking of generics, one (me) could argue that the best way to go about this is to have a connection flag that says "do not touch LFU/LRU stats for read operations" as strings are just one data type (albeit the most common).

As an applicative alternative, the client can maintain a zset of keys and their sizes to make the admin task easier.

Comment From: oranagra

I also think this could be a client flag rather than a command flag. something like CLIENT STEALTHMODE 1 :smile: