Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var RedisSession = (rdKey, afterCb) => {
var key = this._key = BIRD3.sessionKey + rdKey;
var self = this;
redis.get(key, (err, res) => {
if(err) return afterCb(err);
try{
self._store = phpjs.unserialize(res);
} catch(e) {
self._store = {};
}
afterCb(null, self);
});
}
RedisSession.prototype = {
util.request = function (options, callback) {
if (!options.uri || typeof options.uri !== 'string') {
throw new Error('Invalid URI: ' + options.uri);
}
if (!callback || typeof callback !== 'function') {
throw new Error('Invalid callback: ' + callback);
}
if (_useRedis) {
redis.get(options.uri, function (error, results) {
if (!error && results) {
try {
var obj = JSON.parse(results);
callback(null, obj);
return;
} catch (err) {
redis.del(options.uri);
}
}
if (options.static) {
util._get(options, callback);
} else {
util.schedule(function (done) {
util._get(options, function () {
if (done) {
done();