reload a session data from redis
337912
function(callback){
			var self = this;
			if(!this.id){
				return process.nextTick(function(){
					callback(new Error("Invalid session ID"));
				});
			}

			options.client.get(options.keyspace + self.id, function(error, resp){
				if(error)
					return callback(error);
				try{
					resp = JSON.parse(resp);
				}catch(e){
					return callback(e);
				}
				extendSession(self, resp);
				callback();
			});
		}
272033
def refresh_session(self, sessionkey, refresh_token=None):
        '''
        
        '''
        if not refresh_token:
            refresh_token = sessionkey
        params = {
            'appkey' : self.API_KEY,
            'sessionkey'  : sessionkey,
            'refresh_token': refresh_token
        }
        src = ''.join(["%s%s" % (k, v) for k, v in sorted(params.iteritems())]) + self.APP_SECRET
        params['sign'] = md5(src).hexdigest().upper()
        form_data = urllib.urlencode(params)
        rsp = requests.get('%s?%s'%(self.REFRESH_TOKEN_URL, form_data))
        rsp = json.loads(rsp.content)
        if 'error' in rsp:
            raise TOPException(rsp['error'], rsp['error_description'])
            return None
        rsp['re_expires_in'] = int(rsp['re_expires_in'])
        rsp['expires_in'] = int(rsp['expires_in'])
        rsp['session'] = rsp['top_session']
        del rsp['top_session']
        return rsp
628783
def load_data(fname):
    
    print('Loading ' + fname + ' to redis')
    r = redis.StrictRedis(host = '127.0.0.1', port = 6379, db = 0);
    with open(fname, 'r') as f:
        for line_num, row in enumerate(f): 
            if row.strip('') != '':
                if line_num < 100000000:
                    l_key, l_val = parse_n3(row, 'csv')
                    if line_num % 1000 == 0: 
                        print('loading line #', line_num, 'key=', l_key, ' = ', l_val)
                    if l_key != '':
                        r.set(l_key, l_val)
704511
def reload(core = false, loaded = [], &code)
    Manager.connection.reload(core, loaded, &code)
  end
959814
def execute_session(self, session_data):
        ''''''
        pipe = self.client.pipeline()
        for sm in session_data:  # loop through model sessions
            meta = sm.meta
            if sm.structures:
                self.flush_structure(sm, pipe)
            delquery = None
            if sm.deletes is not None:
                delquery = sm.deletes.backend_query(pipe=pipe)
            self.accumulate_delete(pipe, delquery)
            if sm.dirty:
                meta_info = json.dumps(self.meta(meta))
                lua_data = [len(sm.dirty)]
                processed = []
                for instance in sm.dirty:
                    state = instance.get_state()
                    if not meta.is_valid(instance):
                        raise FieldValueError(
                            json.dumps(instance._dbdata['errors']))
                    score = MIN_FLOAT
                    if meta.ordering:
                        if meta.ordering.auto:
                            score = meta.ordering.name.incrby
                        else:
                            v = getattr(instance, meta.ordering.name, None)
                            if v is not None:
                                score = meta.ordering.field.scorefun(v)
                    data = instance._dbdata['cleaned_data']
                    action = state.action
                    prev_id = state.iid if state.persistent else ''
                    id = instance.pkvalue() or ''
                    data = flat_mapping(data)
                    lua_data.extend((action, prev_id, id, score, len(data)))
                    lua_data.extend(data)
                    processed.append(state.iid)
                self.odmrun(pipe, 'commit', meta, (), meta_info,
                            *lua_data, iids=processed)
        return pipe.execute()
537800
function init(){
    self.type = config.type || 'redis';
    if(config.redisMock){
      self.db = config.redisMock;
    }
    else{
      if(config.redisUrl){
        self.redisData = config.redisUrl || null;
      }
      else if(config.redisEnv){
        self.redisData = process.env[config.redisEnv] || null;
      }
      else if(config.redisData){
        self.redisData = config.redisData;
      }
      self.readOnly = (typeof config.readOnly === 'boolean') ? config.readOnly : false;
      try {
        if (self.redisData) {
          if(typeof self.redisData === 'string'){
            self.db = redis.createClient(self.redisData,
              {'no_ready_check': true,
              retry_strategy: retryStrategy});
          } else {
            self.db = redis.createClient(self.redisData.port,
              self.redisData.hostname, {'no_ready_check': true,
              retry_strategy: retryStrategy});

            // don't call redis auth method if no auth info passed
            if (self.redisData.auth) {
              self.db.auth(self.redisData.auth);
            }
          }
          self.db.on('error', function(err) {
            console.log('Error ' + err);
          });
          process.on('SIGTERM', function() {
            self.db.quit();
          });
          log(false, 'Redis client created with the following defaults:', {expiration: self.defaultExpiration, verbose: self.verbose, readOnly: self.readOnly});
        } else {
          self.db = false;
          log(false, 'Redis client not created: no redis config provided');
        }
      } catch (err) {
        self.db = false;
        log(true, 'Redis client not created:', err);
      }
    }
  }
1099265
function connectToRedis(db, opts) {

    // get the redis client
    var client = redis.createClient(opts.port, opts.host);

    // log any errors
    client.on('error', function (err) {
        redisOffline = true;
        console.log('connectToRedis error: ' + err);
    });

    client.on('ready', function () {
        redisOffline = false;
    });

    // if there is a password, do auth
    var deferred = Q.defer();
    if (opts.password) {
        client.auth(opts.password, function (authErr) {
            if (authErr) {
                deferred.reject(authErr);
                return;
            }

            client.select(db, function (err) {
                err ? deferred.reject(err) : deferred.resolve(client);
            });
        });
    }
    else {
        client.select(db, function (err) {
            err ? deferred.reject(err) : deferred.resolve(client);
        });
    }

    return deferred.promise;
}
1009094
def reload(self):
        
        self._load_data(self.objects.data().filter(key=self.key)[0][0], True)
973372
function initRedis(config, callback) {

  var self = this;

  protos.util.checkLocalPort(config.port, function(err) {

    if (err) {
      app.log("RedisTransport [%s:%s] %s", config.host, config.port, err.code);
    } else {

      // Set redis client
      self.client = redis.createClient(config.port, config.host, self.options);

      // Handle error event
      self.client.on('error', function(err) {
        callback.call(self, err);
      });

      // Authenticate if password provided
      if (typeof config.password == 'string') {
        self.client.auth(config.password, function(err, res) {
          if (err) {
            app.log("RedisTransport: [%s:%s] %s", config.host, config.port, err.code);
          } else if (typeof config.db == 'number' && config.db !== 0) {
            self.client.select(config.db, function(err, res) {
              if (err) callback.call(self, err);
              else callback.call(self, null);
            });
          } else {
            callback.call(self, null);
          }
        });
      } else if (typeof config.db == 'number' && config.db !== 0) {
        self.client.select(config.db, function(err, res) {
          callback.call(self, err);
        });
      } else {
        callback.call(self, null);
      }

    }
  });

}
287472
def _do_refresh_session(self):
        """"""
        if self._session and self._last_session_refresh + self._loop_wait > time.time():
            return False

        if self._session:
            try:
                self._client.session.renew(self._session)
            except NotFound:
                self._session = None
        ret = not self._session
        if ret:
            try:
                self._session = self._client.session.create(name=self._scope + '-' + self._name,
                                                            checks=self.__session_checks,
                                                            lock_delay=0.001, behavior='delete')
            except InvalidSessionTTL:
                logger.exception('session.create')
                self.adjust_ttl()
                raise

        self._last_session_refresh = time.time()
        return ret
1167627
function redata(params, onUpdate) {
// console.log('redata()', params);
        // If should not reload the data.
        if (!shouldReload(params)) {
console.log('will not reload');
            // Inform any subscriber.
            onUpdate && onUpdate(ctx.lastData);

            // Resolve with last data.
            return Promise.resolve(ctx.lastData);
        }
console.log('will reload');
        // Data not valid, will load new data and subscribe to its updates.
        // Reset lastData, since it is no longer valid.
        ctx.lastData = { ...defaultInitialData };
// debugger;
        // Update any subscriber about new data.
        onUpdate && onUpdate(ctx.lastData);

        // Store promise reference in order to check which is the last one if multiple resolve.
        ctx.promise = load(ctx, loader, params, onUpdate);
// console.log('storing ctx promise', ctx.promise);
ctx.promise.loader = loader;
        return ctx.promise;
    }
1280513
def reload(self):
        

        result = self._client._get(
            self.__class__.base_url(
                self.sys['id']
            )
        )

        self._update_from_resource(result)

        return self
396516
public function do_read($session_id)
    {
        $redis = is_object($this->_redis) ? $this->_redis : $this->_getRedis();
        $data = $redis->get($this->_prefix . $session_id);
        return is_string($data) ? $data : '';
    }
752290
def cache_data(self, request, data, key='params'):
        
        request.session['%s:%s' % (constants.SESSION_KEY, key)] = data
402000
def update(request):
    """"""
    session = yield from app.ps.session.load(request)
    session['random'] = random.random()
    return session
797686
def load_data(self, data, callback=None):
        ''''''
        return self.backend.execute(
            self.value_pickler.load_iterable(data, self.session), callback)
268127
public function do_write($session_id, $data, $ttl)
    {
        $redis = is_object($this->_redis) ? $this->_redis : $this->_getRedis();
        return $redis->set($this->_prefix . $session_id, $data, $ttl);
    }