I wonder if there is a feature in redis that allow me to get all expired keys (I mean some kind of event, that gives me an opportunity to take back all expire records). The purpose of it is in saving old values into another database. I've heard that it's possible using publishing mechanism, but google can't help we with this idea.
相关问题
- Getting Redis Master address from Sentinel C#
- Microsoft store certification fails due to DPI awa
- Configuring Redis to play nice with AppHarbor
- Why do we need Redis for running CKAN?
- Problem in deserialize redis-cache to objects in S
The built-in expired event generated by keyspace notification is not accurate. See the last section of http://redis.io/topics/notifications
To fully implement an accrue expire event, you might have to implement it by yourself. For example, by using a sorted list (or AVL tree) sorted by the expire time, and continuously reading the tail of list (unqueue). If the reader finds the the expire time hasn't been reached, it sleeps (expire time - now). In this way the accuracy can be controlled within 10s ms.
Use
redis-scheduler
.You can find it here
Current development version of redis contains a new feature: keyspace notifications. Documentation: http://redis.io/topics/notifications
Hopefully, it will make it to stable soon.
BTW, it won't be very useful in helping you save values of expired keys. When expiration event is fired, the value is gone already.