Commit f48cf3a3 authored by rohieb's avatar rohieb
Browse files

simple Redis client

parents
node_modules/
{
"name": "cryptodo",
"version": "0.0.1",
"description": "Web-based To Do list application with client-side cryptography",
"main": "src/server.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "https://github.com/rohieb/cryptodo"
},
"keywords": [
"crypto",
"todo"
],
"author": "Roland Hieber <rohieb@rohieb.name>",
"license": "MIT",
"bugs": {
"url": "https://github.com/rohieb/cryptodo/issues"
},
"dependencies": {
"hiredis": "^0.4.0",
"redis": "^0.12.1"
}
}
var redis_host = "localhost";
var redis_port = "6379";
var redis = require("redis");
console.log("Connecting to Redis server at " + redis_host + ":" + redis_port);
var db = redis.createClient(redis_port, redis_host, { max_attempts: 5,
retry_max_delay: 2000 });
db.on("error", function (err) {
console.error("Redis: " + err);
});
db.on("ready", function () {
console.log("Successfully connected to Redis database.");
});
db.set("cryptodo:id:adc83b19e793491b1c6ea0fd8b46cd9f32e592fc", "hello");
db.get("cryptodo:id:adc83b19e793491b1c6ea0fd8b46cd9f32e592fc", redis.print);
db.quit();
/* vim: set ts=2 sw=2 noet */
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment