1

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.

luiquao
  • 1,094
  • 4
  • 21
  • 46

1 Answers1

3

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

Babak Abadkheir
  • 2,222
  • 1
  • 19
  • 46