Skip to content

Instantly share code, notes, and snippets.

@deevis
Last active August 29, 2015 14:13
Show Gist options
  • Save deevis/989d6f5a34b2c25bbeb0 to your computer and use it in GitHub Desktop.
Save deevis/989d6f5a34b2c25bbeb0 to your computer and use it in GitHub Desktop.
Subscribe to Redis expired key events
redis.subscribe("__keyevent@0__:expired") { |on| on.subscribe { |channel, subscriptions| puts "Subscribed to ##{channel} (#{subscriptions} subscriptions)" }; on.message { |channel, message| puts "Key expired: [#{message}]" }; on.unsubscribe { |channel, subscriptions| puts "Unsubscribed from ##{channel} (#{subscriptions} subscriptions)" }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment