Redis INCR with KEEPTTL

Viewed 13

I'm working with redis and am incrementing a key by 1, however I want to keep the associated TTL with that key when I increment it, unless it doesn't have a TTL, in which case I want to set it to 1.

I've read that there's a KEEPTTL property on the SET command, and that operations such as SET that change a value will set the TTL to either persist if one is not defined in the SET command, or to whatever it is set too. And hence I assumed that INCR does the same.

0 Answers
Related