In reading Short term Redis plans, I’m happy to see the “More introspection” section. For a long time some in the Redis community have asked for the ability to publish key names to a channel when they expire. And, while I sympathize with their desire for such a feature, I also realize that it’s not the greatest solution to the problem (since pub/sub is best effort–a client could be disconnected for a bit and miss messages).
But it looks like Salvatore is taking things a step or two farther…
There is a plan to use Pub/Sub in order to communicate events happening inside Redis, like a key that expired, clients connecting / disconnecting, operations performed against keys. We’ll probably allow the user to script this feature with Lua so that you can, for instance, push all the keys expired inside a list as well, or other things that can’t be reliably done with clients and Pub/Sub since the client is not guaranteed to get all the messages (it can get disconnected for some reason).
This strikes me as really good. He’s been listening to feature requests for a long time. Some appear and vanish after a short time, while others persist. This has been a persistent request for a long time now. Building it in a way that allows for robust notification ought to make everyone happy.
I’ve personally not allowed myself to design systems that would require knowing when a key expires, but seeing this on the roadmap really does open up a lot of possibilities for future work.