sp_user123
sp_user123

Reputation: 502

combining keyspace notification with keyevent notification

I want to get a keyspace notification with a particular key and with a particular event.Like i want a notification when key name 'foo' is operated with a event 'set'.Is there any way to combine both the things like

psubscribe '__keyevent@0__,__keyspace@0__:set foo'.

Upvotes: 1

Views: 1147

Answers (2)

Kaidul
Kaidul

Reputation: 15875

K     Keyspace events, published with __keyspace@<db>__ prefix.
E     Keyevent events, published with __keyevent@<db>__ prefix.
g     Generic commands (non-type specific) like DEL, EXPIRE, RENAME, ...
$     String commands
l     List commands
s     Set commands
h     Hash commands
z     Sorted set commands
x     Expired events (events generated every time a key expires)
e     Evicted events (events generated when a key is evicted for maxmemory)
A     Alias for g$lshzxe, so that the "AKE" string means all the events.

At least K or E should be present in the string, otherwise no event will be delivered regardless of the rest of the string. For instance to enable just Key-space events for lists, the configuration parameter must be set to Kl, and so forth. The string KEA can be used to enable every possible event.

Upvotes: 0

Itamar Haber
Itamar Haber

Reputation: 49942

Regrettably no - you'll have to subscribe both to the events and the keyspace notifications and filter the messages in the subscriber.

Upvotes: 1

Related Questions