1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-09 00:22:08 +03:00

Add MONITOR command and special monitor command reply parsing.

This commit is contained in:
Matt Ranney
2011-03-14 15:50:47 -10:00
parent 1a14e24faa
commit 2fcc947f11
5 changed files with 47 additions and 10 deletions

View File

@@ -394,6 +394,29 @@ of commands and arguments to the constructor:
});
## Monitor mode
Redis supports the `MONITOR` command, which lets you see all commands received by the Redis server
across all client connections, including from other client libraries and other computers.
After you send the `MONITOR` command, no other commands are valid on that connection. `node_redis`
will emit a `monitor` event for every new monitor message that comes across. The callback for the
`monitor` event takes a timestamp from the Redis server and an array of command arguments.
Here is a simple example:
var client = require("redis").createClient(),
util = require("util");
client.monitor(function (err, res) {
console.log("Entering monitoring mode.");
});
client.on("monitor", function (time, args) {
console.log(time + ": " + util.inspect(args));
});
# Extras
Some other things you might like to know about.