node_redis 介绍
Redis 是一个基于内存的键(key)值(value)类型的数据结构存储容器,它既可以完全工作在内存中,也可以持久化存储。
使用 Node.js 来进行开发,Redis 推荐使用的 Node.js 驱动为 Node_Redis 插件。
node_redis安装
npm install redis
node_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();
});
GitHub:https://github.com/NodeRedis/node_redis
node_redis
官方网站:http://redis.js.org/
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。