Currently there is no way to change value for a key which has an expiration so that the expiration would remain exactly as is.

The only way is to query TTL and then do SET ... EX . That not only adds an unnecessary overhead, but also is not precise.

It would be nice if some flavor of SET would keep the existing expiration.

See also https://stackoverflow.com/questions/6935519/how-do-i-keep-the-expiration-of-a-redis-key-even-when-i-set-something-to-it

Thanks for considering

Ideal would be if SET didn't reset expiration by default, only with e.g. PERSIST param (SET ... PERSIST ...) but I guess that's not Redis team's taste.

Comment From: itamarhaber

Hello @OndraZizka

It appears that #6679 adds this.

Comment From: OndraZizka

Right.