lib/type/hash.js
function delExpiredKeys(num, threshold) {

  function removeExpiredKeys(count) {
    if(!this._ekeys.length) return 0;
    var num = num || 100
      , threshold = threshold || 25
      , count = count || 0
      , i
      , key
      , ind;

    for(i = 0;i < num;i++) {
      ind = Math.floor(Math.random() * this._ekeys.length);
      key = this._ekeys[ind];
      if(this._expires[key] <= Date.now()) {
        this.emit('expired', key);
        this.delKey(key);
        count++;
      }
    }

    if(count >= threshold) {
      setImmediate(removeExpiredKeys);
    }

    return count;
  }

  removeExpiredKeys = removeExpiredKeys.bind(this);
  return removeExpiredKeys();
}
function delExpiredKeys(num, threshold) {

  function removeExpiredKeys(count) {
    if(!this._ekeys.length) return 0;
    var num = num || 100
      , threshold = threshold || 25
      , count = count || 0
      , i
      , key
      , ind;

    for(i = 0;i < num;i++) {
      ind = Math.floor(Math.random() * this._ekeys.length);
      key = this._ekeys[ind];
      if(this._expires[key] <= Date.now()) {
        this.emit('expired', key);
        this.delKey(key);
        count++;
      }
    }

    if(count >= threshold) {
      setImmediate(removeExpiredKeys);
    }

    return count;
  }

  removeExpiredKeys = removeExpiredKeys.bind(this);
  return removeExpiredKeys();
}
function delExpiredKeys ( num , threshold ) { function removeExpiredKeys ( count ) { if ( ! this . _ekeys . length ) return 0 ; var num = num || 100 , threshold = threshold || 25 , count = count || 0 , i , key , ind ; for ( i = 0 ; i < num ; i ++ ) { ind = Math . floor ( Math . random ( ) * this . _ekeys . length ) ; key = this . _ekeys [ ind ] ; if ( this . _expires [ key ] <= Date . now ( ) ) { this . emit ( 'expired' , key ) ; this . delKey ( key ) ; count ++ ; } } if ( count >= threshold ) { setImmediate ( removeExpiredKeys ) ; } return count ; } removeExpiredKeys = removeExpiredKeys . bind ( this ) ; return removeExpiredKeys ( ) ; }
Passive expiry.

Picks 100 keys at random from the list of expired keys
and if the number of expired keys exceeds 25 continue to
delete expired keys.
Passive expiry .