Observe redis keyevent/keyspace and notify
Add this line to your application's Gemfile:
gem 'redis_notifier'
And then execute:
$ bundle
Or install it yourself as:
$ gem install redis_notifier
require 'redis'
require 'redis_notifier'
redis_notifier = RedisNotifier::Base.new(Redis.new)
redis_notifier.on_event(:expired) do |key|
puts "** #{key} as expired"
end
redis_notifier.observe_key('keys:my_key') do |event|
puts ">> event '#{event}' on 'keys:my_key"
end
redis_notifier.listen
- Fork it ( https://github.com/[my-github-username]/redis_notifier/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request