Emits Redis-compatible keyspace and keyevent notifications via PubSub.
When the notify-keyspace-events configuration value is set (non-empty),
key mutation operations fire pub/sub messages on two channel families:
__keyspace@0__:<key>-- carries the event name as the message__keyevent@0__:<event>-- carries the key name as the message
Configuration flags
The notify-keyspace-events config value is a string of flag characters:
K-- enable__keyspace@0__:<key>channelE-- enable__keyevent@0__:<event>channelg-- generic commands: DEL, EXPIRE, RENAME, PERSIST, COPY$-- string commands: SET, INCR, APPEND, GETSETx-- expired eventsA-- alias for all event types (g$x)
At least one of K or E must be present along with at least one event
type flag for notifications to fire.
Examples
# Enable keyspace + keyevent for all event types:
Ferricstore.Config.set("notify-keyspace-events", "KEA")
# Enable only keyevent for string commands:
Ferricstore.Config.set("notify-keyspace-events", "E$")
Summary
Functions
Fires keyspace and/or keyevent notifications for a key mutation.
Determines whether a notification should fire for the given event based on the configured flags.
Functions
Fires keyspace and/or keyevent notifications for a key mutation.
Reads the notify-keyspace-events config to determine which channels
to publish to. Does nothing if notifications are disabled (empty config)
or if the event type is not covered by the configured flags.
Parameters
key- the key that was mutatedevent- the event name (e.g."set","del","expire")flags- (optional) override config flags; ifnil, reads fromFerricstore.Config
Returns
:ok
Determines whether a notification should fire for the given event based on the configured flags.
Parameters
event- the event nameflags- the flag string from config
Returns
true if the event matches the configured flags, false otherwise.