simple-lru.js
function (key, val) {
      var entry = this._byKey.get(key);

      // reuse entry if the key exists
      if (entry) {
        this._touch(entry);
        entry.val = val;
        return;
      }

      entry = new Entry(key, val, this._head++);
      this._byKey.set(key, entry);
      this._byOrder[entry.index] = entry;
      this._len++;
      this._trim();
    }
function (key, val) {
      var entry = this._byKey.get(key);

      // reuse entry if the key exists
      if (entry) {
        this._touch(entry);
        entry.val = val;
        return;
      }

      entry = new Entry(key, val, this._head++);
      this._byKey.set(key, entry);
      this._byOrder[entry.index] = entry;
      this._len++;
      this._trim();
    }
function ( key , val ) { var entry = this . _byKey . get ( key ) ; // reuse entry if the key exists if ( entry ) { this . _touch ( entry ) ; entry . val = val ; return ; } entry = new Entry ( key , val , this . _head ++ ) ; this . _byKey . set ( key , entry ) ; this . _byOrder [ entry . index ] = entry ; this . _len ++ ; this . _trim ( ) ; }
Set cache by key
@param {String} unique string key
@param {String|Object|Number} any value
Set cache by key