node-redis

Updating cookie session in express not registering with browser

会有一股神秘感。 提交于 2019-11-30 21:29:06
I've set up a working login test as follows: var express = require('express'); var fs = require('fs'); var http = require('http'); var path = require('path'); var routes = require('./routes/index.coffee'); var passport = require('passport'); var LocalStrategy = require('passport-local').Strategy; var User = require('./userdb.coffee'); var app = express(); var RedisStore = require('connect-redis')(express); passport.use(new LocalStrategy(function(username, password, done) { return User.findOne({ username: username }, function(err, user) { if (err) { return done(null, false, message: error); }

Updating cookie session in express not registering with browser

泄露秘密 提交于 2019-11-30 17:07:52
问题 I've set up a working login test as follows: var express = require('express'); var fs = require('fs'); var http = require('http'); var path = require('path'); var routes = require('./routes/index.coffee'); var passport = require('passport'); var LocalStrategy = require('passport-local').Strategy; var User = require('./userdb.coffee'); var app = express(); var RedisStore = require('connect-redis')(express); passport.use(new LocalStrategy(function(username, password, done) { return User.findOne

Efficient way redis set member update

天大地大妈咪最大 提交于 2019-11-29 16:42:21
I have a redis set. This set can store 20 members maximum(added with SADD command). My problem is ; I need to update that members when needed. Members need that modification maximum 10 times for every member. Set members are json as a string. There is only solutoin on my mind nor, get all members update and recreate that set again. But it seems iditoic. I know there is ZADD sorted set with its score support it seems suitable also I need to update score like data in json , but i just wonder Is there any method updating members in efficient way, or is updating member not acceptable on redis way

Redis WATCH MULTI EXEC by one client

寵の児 提交于 2019-11-28 12:07:10
I am using NodeJS + Express + Redis on RedisOnGo + node_redis as a client. I expect a lot of concurrency, so trying to test WATCH. This example won't contain Express, just necessary stuff. var redis = require("redis") var rc = redis.createClient(config.redis.port, config.redis.host) rc.auth(config.redis.hash, function(err) { if (err) { throw err } }) rc.on('ready', function () { rc.set("inc",0) for(var i=1;i<=10;i++){ rc.watch("inc") rc.get("inc",function(err,data){ var multi = rc.multi() data++ // I do know I can use rc.incr(), this is just for example multi.set("inc",data) multi.exec

Efficient way redis set member update

♀尐吖头ヾ 提交于 2019-11-28 10:58:23
问题 I have a redis set. This set can store 20 members maximum(added with SADD command). My problem is ; I need to update that members when needed. Members need that modification maximum 10 times for every member. Set members are json as a string. There is only solutoin on my mind nor, get all members update and recreate that set again. But it seems iditoic. I know there is ZADD sorted set with its score support it seems suitable also I need to update score like data in json , but i just wonder Is

Redis WATCH MULTI EXEC by one client

﹥>﹥吖頭↗ 提交于 2019-11-27 06:44:57
问题 I am using NodeJS + Express + Redis on RedisOnGo + node_redis as a client. I expect a lot of concurrency, so trying to test WATCH. This example won't contain Express, just necessary stuff. var redis = require("redis") var rc = redis.createClient(config.redis.port, config.redis.host) rc.auth(config.redis.hash, function(err) { if (err) { throw err } }) rc.on('ready', function () { rc.set("inc",0) for(var i=1;i<=10;i++){ rc.watch("inc") rc.get("inc",function(err,data){ var multi = rc.multi()

Scaling Socket.IO to multiple Node.js processes using cluster

試著忘記壹切 提交于 2019-11-26 03:47:38
问题 Tearing my hair out with this one... has anyone managed to scale Socket.IO to multiple \"worker\" processes spawned by Node.js\'s cluster module? Lets say I have the following on four worker processes (pseudo): // on the server var express = require(\'express\'); var server = express(); var socket = require(\'socket.io\'); var io = socket.listen(server); // socket.io io.set(\'store\', new socket.RedisStore); // set-up connections... io.sockets.on(\'connection\', function(socket) { socket.on(\