hit(input) {
    if (!this[client] || !this[client].isConnected()) return Promise.resolve(null);
    return new Promise((resolve) => {
      let type = (input.role_id ? 'role' : 'user'),
        hashKey = this.getHashField(input.access_id, type),
        hashField = (type === 'role' ? input.role_id : input.user_id);
      this[client].exec('HGET', hashKey, hashField, (err, res) => {
        if (err) {
          return resolve(null);
        }
        if (res == null) return resolve(res);
        try {
          res = JSON.parse(res);
        } catch (e) {
          return resolve(null);
        }
        this.expire(hashKey);
        resolve(res);
      });
    });
  }
/*
   * HIT the cache for the given input.
   * */
HIT the cache for the given input.
HIT the cache for the given input .
hit(input) {
    if (!this[client] || !this[client].isConnected()) return Promise.resolve(null);
    return new Promise((resolve) => {
      let type = (input.role_id ? 'role' : 'user'),
        hashKey = this.getHashField(input.access_id, type),
        hashField = (type === 'role' ? input.role_id : input.user_id);
      this[client].exec('HGET', hashKey, hashField, (err, res) => {
        if (err) {
          return resolve(null);
        }
        if (res == null) return resolve(res);
        try {
          res = JSON.parse(res);
        } catch (e) {
          return resolve(null);
        }
        this.expire(hashKey);
        resolve(res);
      });
    });
  }
hit ( input ) { if ( ! this [ client ] || ! this [ client ] . isConnected ( ) ) return Promise . resolve ( null ) ; return new Promise ( ( resolve ) => { let type = ( input . role_id ? 'role' : 'user' ) , hashKey = this . getHashField ( input . access_id , type ) , hashField = ( type === 'role' ? input . role_id : input . user_id ) ; this [ client ] . exec ( 'HGET' , hashKey , hashField , ( err , res ) => { if ( err ) { return resolve ( null ) ; } if ( res == null ) return resolve ( res ) ; try { res = JSON . parse ( res ) ; } catch ( e ) { return resolve ( null ) ; } this . expire ( hashKey ) ; resolve ( res ) ; } ) ; } ) ; }
HIT the cache for the given input.
HIT the cache for the given input .