“Redis 服务的生命周期与应用程序的生命周期独立,所以存储在服务中的数据会在应用程序重新启动后持久保存。”
1 2 3 4 5 6 | services: redis-5a659: label: redis provider: core version: '2.6' plan: 100 |
1 | client.incrby("DBuserCountBy2", 2, function (err, replyBy2); |
1 2 | client.incrby("DBuserCountBy1", 1, function (err, replyBy1) { client.incrby("DBuserCountBy2", 2, function (err, replyBy2) { |
1 | res.render('index', {userCount: userCount, DBuserCountBy1: replyBy1, DBuserbytwo: replyBy2}); |
1 2 3 4 5 6 7 8 9 | app.get('/', function(req, res) { userCount = userCount + 1; // Increment the value in the database and render the results client.incrby("DBuserCountBy1", 1, function (err, replyBy1) { client.incrby("DBuserCountBy2", 2, function (err, replyBy2) { res.render('index', {userCount: userCount, DBuserCountBy1: replyBy1, DBuserbytwo: replyBy2}); }); }); }); |
1 | <p>The stored user count by two in my redis database is <%= DBuserCountBy2 %></p>. |
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) | Powered by Discuz! 7.0.0 |