in connect-redis to return session value use .get(sid, callback) but it always return null so I think its not save in redis but I check it session save in redis correctly after investigation find problem is with Sid see /connect-redis/lib/connect-redis.js
RedisStore.prototype.get = function(sid, fn){
sid =this.prefix + sid;
debug('GET "%s"', sid);
console.log('lib');
console.log(sid);
this.client.get( sid , function(err, data){
if (err) return fn(err);
if (!data) return fn(null,'');
var result;
data = data.toString();
debug('GOT %s', data);
try {
result = JSON.parse(data);
} catch (err) {
return fn(err);
}
return fn(null, result);
});
};
if I but sessionID as string it will return session
RedisStore.prototype.get = function(sid, fn){
// sid =this.prefix + sid;
debug('GET "%s"', sid);
console.log('lib');
console.log(sid);
this.client.get( 'lweUw//EdbygbGr/2gAZt0kb' , function(err, data){
if (err) return fn(err);
if (!data) return fn(null,'');
var result;
data = data.toString();
debug('GOT %s', data);
try {
result = JSON.parse(data);
} catch (err) {
return fn(err);
}
return fn(null, result);
});
};
Note:
typeof(sid) is string even if add qoute to sid like this "\'sid\'" it will return null