How to use the redis.get function in redis

To help you get started, we’ve selected a few redis examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DragonsInn / BIRD3 / app / Backend / Service / Web.js View on Github external
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 = {
github emmorts / lolapi / lib / util.js View on Github external
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();