Skip to content

RedisLabs/rmnotify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

rmnotify

In Redis it's possible to subscribe to Pub/Sub channels in order to receive events affecting the Redis data set in some way, see docs.

For example, you might be interested in knowing about all operations touching a certain key (key space notification), or you might want to know if all keys have been deleted (event space notification).

Unfortunately, the Redis modules API has yet to support module registration for either key/event space notifications. Until native support is implemented you can use this library to register for both key and event space notifications.

Usage

To receive notifications for a specific key ("foo") call

void fnKeyNotify(const char* key, const char* event) {...}
notifierRegisterKey(notifier, "foo", fnKeyNotify);

And for event ("del") notifications:

void fnEventNotify(const char* event, const char* key) {...}
notifierRegisterEvent(notifier, "del", fnEventNotify);

See either demo.c or test.c for additional examples.

Build

Build dependencies, from rmnotify_root/deps/hiredis run:

make

Build rmnotify, from rmnotify_root/src run:

make all

Run tests (make sure a local Redis server is running), from rmnotify_root/src/test run:

make test && ./test

About

A library for key and event space Notifications for Redis Modules

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published