Node js redis
生活随笔
收集整理的這篇文章主要介紹了
Node js redis
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
const redis = require('redis');//redis const client = redis.createClient(8888, '172.16.4.2'); //redis操作client.set("hello", "{\"a\":\"1\", \"b\":\"2\"}") client.get("hello", function(err, value){console.log(value);jsonObj = JSON.parse(value);//將字符串轉換為json對象
console.log(jsonObj.a);})client.expire('hello', 3);// NX是不存在時才set, XX是存在時才set, EX是秒,PX是毫秒client.set("hello", "{\"a\":\"1\", \"b\":\"2\"}", "NX", "EX", 60*10);
隊列
client.rpush('hello11Lists','1');?
轉載于:https://www.cnblogs.com/Guroer/p/10475724.html
總結
以上是生活随笔為你收集整理的Node js redis的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: CSS: hover选择器的使用
- 下一篇: 在PowerDesigner中设计概念模