| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [View Raw Code] [Original HTTPS Page] |
Redis is an open-source, networked, in-memory, key-value data store with optional durability.
Redis as Node.js also runs single-threaded.
Some helpful commands:
redis-cli doesn't allow to execte scripts only commands.
C:\Program Files\Redis>redis-cli.exe -h redis-cli 2.4.6 (git:26cdd13a) Usage: redis-cli [OPTIONS] [cmd [arg [arg ...]]] -h Server hostname (default: 127.0.0.1) -p Server port (default: 6379) -s Server socket (overrides hostname and port) -a Password to use when connecting to the server -r Execute specified command N times -i When -r is used, waits seconds per command. It is possible to specify sub-second times like -i 0.1. -n Database number -x Read last argument from STDIN -d Multi-bulk delimiter in for raw formatting (default: \n) --raw Use raw formatting for replies (default when STDOUT is not a tty) --latency Enter a special mode continuously sampling latency. --help Output this help and exit --version Output version and exit Examples: cat /etc/passwd | redis-cli -x set mypasswd redis-cli get mypasswd redis-cli -r 100 lpush mylist x redis-cli -r 100 -i 1 info | grep used_memory_human: When no command is given, redis-cli starts in interactive mode. Type "help" in interactive mode for information on available commands.
node_redis is a node.js redis client.
Create new Node.js project, then run npm install redis --save in Terminal.
Hint: drap&drop redis-cli executable into Eclipse project to create comfortable link (see above).
Example
var redis = require("redis"),
client = redis.createClient();
// if you'd like to select database 3, instead of 0 (default), call
// client.select(3, function() { /* ... */ });
client.on("error", function (err) {
console.log("Error " + err);
});
client.set("string key", "string val", redis.print);
client.hset("hash key", "hashtest 1", "some value", redis.print);
client.hset(["hash key", "hashtest 2", "some other value"], redis.print);
client.hkeys("hash key", function (err, replies) {
console.log(replies.length + " replies:");
replies.forEach(function (reply, i) {
console.log(" " + i + ": " + reply);
});
client.quit();
});| Back | FazBrowse Home | New Git URL |