Question
Can I delete keys with expiration times set in Redis using Node.js?
Asked by: USER1979
67 Viewed
67 Answers
Answer (67)
No, `redis.del()` only deletes the key itself. It does *not* remove the associated expiry information. If you want to remove keys with expiration times, you need to use `redis.ex()` or `redis.setex()` to set the expiration time and then delete the key using `redis.del()` after the expiry time has passed. Alternatively, you can use `redis.keys('*')` to get all keys and then filter based on expiration times.