function* onPmessage(pattern, channel, key) {
  try {
    if (key.indexOf(SEPERATOR) === -1) {
      if (config.reloadExpired && channel.indexOf(':expired') !== -1) {
        const tags = [];
        let reloadExpired = false;
        const timesGot = yield client.getAsync(`${key}${SEPERATOR}timesGot`);
        if (timesGot && timesGot > config.cacheTimesGot) {
          tags.push('reload_type:times_got');
          reloadExpired = true;
          ee.emit('expired', key);
        } else {
          const reloadCache = yield client.sismemberAsync(RELOAD_CACHE_KEY, key);
          if (reloadCache) {
            tags.push('reload_type:cache_key');
            reloadExpired = true;
            ee.emit('expired', key);
          }
        }
        if (reloadExpired === true) {
          datadog.increment('reload_expired', 1, tags);
        }
      } else if (channel.indexOf(':set') !== -1) {
        ee.emit(`${key}set`);
      }
    }
  } catch (err) {
    logger.error(err);
  }
}
/**
 * Emits appropriate event caught on expiry of value in redis or when value is set in redis.
 * Expired event is only fired in specific cases.
 *
 * @param {any} pattern
 * @param {any} channel
 * @param {any} key
 */
Emits appropriate event caught on expiry of value in redis or when value is set in redis.
Expired event is only fired in specific cases.


Emits appropriate event caught on expiry of value in redis or when value is set in redis . Expired event is only fired in specific cases .
function* onPmessage(pattern, channel, key) {
  try {
    if (key.indexOf(SEPERATOR) === -1) {
      if (config.reloadExpired && channel.indexOf(':expired') !== -1) {
        const tags = [];
        let reloadExpired = false;
        const timesGot = yield client.getAsync(`${key}${SEPERATOR}timesGot`);
        if (timesGot && timesGot > config.cacheTimesGot) {
          tags.push('reload_type:times_got');
          reloadExpired = true;
          ee.emit('expired', key);
        } else {
          const reloadCache = yield client.sismemberAsync(RELOAD_CACHE_KEY, key);
          if (reloadCache) {
            tags.push('reload_type:cache_key');
            reloadExpired = true;
            ee.emit('expired', key);
          }
        }
        if (reloadExpired === true) {
          datadog.increment('reload_expired', 1, tags);
        }
      } else if (channel.indexOf(':set') !== -1) {
        ee.emit(`${key}set`);
      }
    }
  } catch (err) {
    logger.error(err);
  }
}
function * onPmessage ( pattern , channel , key ) { try { if ( key . indexOf ( SEPERATOR ) === - 1 ) { if ( config . reloadExpired && channel . indexOf ( ':expired' ) !== - 1 ) { const tags = [ ] ; let reloadExpired = false ; const timesGot = yield client . getAsync ( ` ${ key } ${ SEPERATOR } ` ) ; if ( timesGot && timesGot > config . cacheTimesGot ) { tags . push ( 'reload_type:times_got' ) ; reloadExpired = true ; ee . emit ( 'expired' , key ) ; } else { const reloadCache = yield client . sismemberAsync ( RELOAD_CACHE_KEY , key ) ; if ( reloadCache ) { tags . push ( 'reload_type:cache_key' ) ; reloadExpired = true ; ee . emit ( 'expired' , key ) ; } } if ( reloadExpired === true ) { datadog . increment ( 'reload_expired' , 1 , tags ) ; } } else if ( channel . indexOf ( ':set' ) !== - 1 ) { ee . emit ( ` ${ key } ` ) ; } } } catch ( err ) { logger . error ( err ) ; } }
Emits appropriate event caught on expiry of value in redis or when value is set in redis.
Emits appropriate event caught on expiry of value in redis or when value is set in redis .