Revent
Redis pub/sub module for NodeJS
Install
npm i reventjs --save
Config
host: /* Redis host */port: /* Redis port */db: /* Redis DB connect */options: /* Redis options */createClient: /* Redis client instance */messagePattern: /* Message pattern RexExp*/
Usage
Subscribe
;const redis = Revent; redis; // ORredis; redis;
Unsubscribe
// space - Keyspaceredis; // event - Keyeventredis;
Publish
redis;
Connection close
redis; //Hardredis;
Redis command
redis;
Important
Do not forget to set up Redis and add to redis.conf line:
--notify-keyspace-events <options>
- K Keyspace events, published with keyspace@ prefix.
- E Keyevent events, published with keyevent@ 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.
It is also possible to use the. view