Re: On Key Expire - Notification

96 views
Skip to first unread message

Josiah Carlson

unread,
Jul 26, 2012, 11:23:35 AM7/26/12
to redi...@googlegroups.com
It's a relatively new feature that is not done yet. More specifically,
Salvatore mentioned that he had an idea for building it within the
last week. Feel free to wait patiently.

Regards,
- Josiah

On Thu, Jul 26, 2012 at 8:16 AM, Scarpacci <mike.gia...@gmail.com> wrote:
> Hi All,
>
> I found various content about the Key Expire Notification on the web, but I
> can't find any plans of it any of the release documentation I have looked
> at. I apologize if it has been right in front of me all along....I just
> can't seem to find it. Any info you can provide regarding this feature
> would be greatly appreciated.
>
> Thanks,
>
> S
>
> --
> You received this message because you are subscribed to the Google Groups
> "Redis DB" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/redis-db/-/2hZrHDRSBkoJ.
> To post to this group, send email to redi...@googlegroups.com.
> To unsubscribe from this group, send email to
> redis-db+u...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/redis-db?hl=en.

Dvir Volk

unread,
Jul 26, 2012, 11:31:17 AM7/26/12
to redi...@googlegroups.com
mean while it can be done with an ugly workaround:

1. set up a slave to your instance.
2. add every "to be expired" key to a set.
3. listen with a client to the MONITOR stream on the slave.
4. the slave will receive DEL on any key that's being expired, and that can be sniffed via MONITOR.
5. when you get a key that's about to be expired, check if it exists in your expired set, if it is, you have yourself a winner!

of course you can have false positives if someone manually deletes a volatile key, but that's more or less like an expiration, so you should be good.

also, you can keep the expired set on the client side by listening on EXPIRE/SETEX etc, but it's a waste of memory if you have many clients.
Reply all
Reply to author
Forward
0 new messages