Skip to content

Instantly share code, notes, and snippets.

@tadassce
Created September 21, 2017 08:40
Show Gist options
  • Save tadassce/4f7520887f0650e99c7107da858de910 to your computer and use it in GitHub Desktop.
Save tadassce/4f7520887f0650e99c7107da858de910 to your computer and use it in GitHub Desktop.
Subscribe to Redis HSET events
require 'redis'
redis = Redis.new
redis.config(:set, 'notify-keyspace-events', 'Eh')
redis.psubscribe('__keyevent@*__:hset') do |on|
on.pmessage do |_pattern, _channel, hash_key|
puts "Hash #{hash_key} has been updated."
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment