I am using REDIS and setting keys that expire in 24 hours. During those 24 hours, some stats data is being continuously updated on them. (These keys are sort of like a dynamic session). It will be useful for me to collate all the information of the key and store in some persistent storage stored just prior to its expiry. Is there a way out?
Asked
Active
Viewed 3,530 times
1 Answers
0
Yeah, though there is no direct API exists for expiry but you can find a way out using redis keyspace notification. To learn more about how to use/implement this please follow these links:

MD Ruhul Amin
- 4,386
- 1
- 22
- 37
-
Thanks @Ruhul. The documentation reads "Basically expired events **are generated when the Redis server deletes the key** and not when the time to live theoretically reaches the value of zero". That, perhaps, won't serve my purpose – RmR Aug 13 '18 at 12:06
-
I may have to set another key at the same time with an expiry few seconds earlier and use that event trigger to read the contents of the desired key to save. Seem convoluted. Hmm – RmR Aug 13 '18 at 12:08