Used for redis version <= 2.3
486659
function createStreamListenersWrap(api) {
  return function streamListenersWrap(install_stream_listeners) {
    return function install_stream_listeners_trace() {
      api.wrapEmitter(this.stream);
      return install_stream_listeners.apply(this, arguments);
    };
  };
}
467556
def method_missing(method, *args, &block)
      if redis_operation?(method)
        dispatch(method, *args, &block)
      else
        super
      end
    end
1242670
function parseError(e) {
  if(e.ns === 'STORE.REDIS') return true;
  if(e.code && e.code.indexOf('REDIS') === 0) {
    e.ns = 'STORE.REDIS';
    return true;
  }
}
639400
function (model) {
              var tokenCode = 'token-' + md5(new Date().toString()) + md5(model.id + Math.random().toString());
              var redisExpire = (global._gluon_auth_expire) >>> 0; //redis using seconds not milliseconds
              return redisClient.setAsync(tokenCode, JSON.stringify(model.toJSON())).then(function () {
                return redisClient.expireAsync(tokenCode, redisExpire);
              }).then(function () {
                return {code: tokenCode, expire: new Date(Date.now() + redisExpire * 1000)};
              });
            }
828900
def _version_less_than_or_equal_to(self, v1, v2):
        
        # pylint: disable=no-name-in-module, import-error
        from distutils.version import LooseVersion
        return LooseVersion(v1) <= LooseVersion(v2)
484707
def compat_py2_py3():
    
    if (sys.version_info > (3, 0)):
        def iteritems(dictionary):
            return dictionary.items()

        def itervalues(dictionary):
            return dictionary.values()

    else:
        def iteritems(dictionary):
            return dictionary.iteritems()

        def itervalues(dictionary):
            return dictionary.itervalues()

    return iteritems, itervalues
772005
def do_version():
    """"""
    v = ApiPool.ping.model.Version(
        name=ApiPool().current_server_name,
        version=ApiPool().current_server_api.get_version(),
        container=get_container_version(),
    )
    log.info("/version: " + pprint.pformat(v))
    return v
1320330
def value_from_redis
      if val = Timely.redis.hget(redis_hash_key, redis_value_key)
        val = val.include?(".") ? val.to_f : val.to_i
      else
        val = value_without_caching
        Timely.redis.hset(redis_hash_key, redis_value_key, val)
      end

      val
    end
573411
function(keys){

  console.log('\nInitializing keys in Redis...\n')

  keys.forEach(function(el,i){

    client.get(el.key, function(e,d){

      if(e) {
        console.log("Error trying to get %s ", el.key)
        return console.error(e)
      }

      // checking for falsey values only is a bad idea
      if(typeof d === 'undefined'){

        console.log("Not OK trying to get %s ", el.key)

        client.set(el.key, el.initialValue, function(e,d){
          if(e) {
            console.log("Error trying to set %s ", el.key)
            return console.error(e)
          }
          if(d !== 'OK') {
            console.log("Not OK trying to set %s ", el.key)
            return console.warn(el.key + " was not set.")
          }
          if(d === 'OK') {
            console.log("OK setting %s ", el.key)
            client.get(el.key, function(e,d){
             console.log(d) 
            })
          }

        }) // end set.
      }

      console.log("The value for key %s is %s", el.key.yellow, d.green)

    }) // end get

  })
}
1151214
function dataPreprocess (version) {
        var util = require('./util');

        if (util.isNumber(version)) {
            version = version.toString();
        }
        if (util.isArray(version)) {
            version = version.join('.');
        }

        if (util.isCorrectVersion(version)) {
            return util.toArray(version);
        }

        return 'Wrong Params.';
    }
821368
function parseFlashVersion(desc) {
      var matches = desc.match(/[\d]+/g);
      matches.length = 3;
      return matches.join(".");
    }
1159195
protected function redis($redis = '')
    {
        $redis = $redis ? $redis : $this->use_redis;

        return Redis::getInstance($redis);
    }
1040117
def hstrlen(self, name, key):
        
        with self.pipe as pipe:
            return pipe.hstrlen(self.redis_key(name), key)
1275782
function(cfg) {
// DynoFarm overrides
  if (cfg && cfg.redis) {
    if (cfg.redis.host) {
      redisHost = cfg.redis.host;
    }
    if (cfg.redis.port) {
      redisPort = cfg.redis.port;
    }
    if (cfg.redis.password) {
      redisPassword = cfg.redis.password;
    }
  }

  var client = redis.createClient(redisPort, redisHost);
  if (redisPassword) {
    client.auth(redisPassword);
  }
  return client;
}
327867
def _init_redis(redis_spec):
        
        if not redis_spec:
            return
        if isinstance(redis_spec, six.string_types):
            return redis.StrictRedis.from_url(redis_spec)
        # assume any other value is a valid instance
        return redis_spec
564921
def after_init_apps(sender):
    
    from uliweb import settings
    from uliweb.utils.common import log
    
    check = settings.get_var('REDIS/check_version')
    if check:
        client = get_redis()
        try:
            info = client.info()
        except Exception as e:
            log.exception(e)
            log.error('Redis is not started!')
            return
        
        redis_version = info['redis_version']
        version = tuple(map(int, redis_version.split('.')))
        op = re_compare_op.search(check)
        if op:
            _op = op.group()
            _v = check[op.end()+1:].strip()
        else:
            _op = '='
            _v = check
        nv = tuple(map(int, _v.split('.')))
        if _op == '=':
            flag = version[:len(nv)] == nv
        elif _op == '>=':
            flag = version >= nv
        elif _op == '>':
            flag = version > nv
        elif _op == '<=':
            flag = version <= nv
        elif _op == '<':
            flag = version < nv
        else:
            log.error("Can't support operator %s when check redis version" % _op)
        if not flag:
            log.error("Redis version %s is not matched what you want %s" % (redis_version, _v))
246122
function version(options) {
  let opts = options || {
    typeKey: '_type',
  };
  if (typeof options === 'string') {
    opts = {
      typeKey: options,
    };
  }
  const typeKey = opts.typeKey;
  const override = opts.override;

  return (ctx, next) => {
    const query = ctx.query;
    const currentPath = ctx.path;
    const reg = /^\/v\d+/i;
    const result = reg.exec(currentPath);
    const acceptConfig = {};
    if (result) {
      const versionDesc = result[0];
      const v = parseInt(versionDesc.substring(2), 10);
      /* eslint no-param-reassign:0 */
      ctx.path = ctx.path.substring(versionDesc.length);
      if (override) {
        ctx.originalPath = ctx.path;
      }
      acceptConfig.version = v;
    }
    if (query[typeKey]) {
      acceptConfig.type = query[typeKey];
      delete query[typeKey];
      /* eslint no-param-reassign:0 */
      ctx.query = query;
    }
    const acceptReg = /^application\/vnd\.\S+\.v(\d)+(\+(\S+))?/i;
    const acceptResult = acceptReg.exec(ctx.get('Accept'));
    /* istanbul ignore else */
    if (acceptResult) {
      acceptConfig.version = parseInt(acceptResult[1], 10);
      /* istanbul ignore else */
      if (acceptResult[3]) {
        acceptConfig.type = acceptResult[3];
      }
    }
    /* istanbul ignore else */
    if (acceptConfig.version) {
      /* eslint no-param-reassign:0 */
      ctx.state.acceptConfig = acceptConfig;
      ctx.versionConfig = acceptConfig;
    }
    return next();
  };
}