luiquao
luiquao

Reputation: 1114

Does Redis reset expiration time

I am using client.setex() to create a Redis cache with an expiration time of say 3600 seconds but I also update it from time to time, and for that I am using client.set(). Wondering if the expiration time stays the same or gets extended by 3600 every time I update that cache.

Upvotes: 1

Views: 3921

Answers (1)

Babak Abadkheir
Babak Abadkheir

Reputation: 2350

set() will remove the existing expiration time in Redis .

you can use :

client.set(key,value, "EX", client.ttl(key))

for continuing the expiration time.

for more detail :

https://stackoverflow.com/a/21897851/5677187

Upvotes: 3

Related Questions