function LRUCache (limit) {
  // Current size of the cache. (Read-only).
  this.size = 0
  // Maximum number of items this cache can hold.
  this.limit = limit
  this._keymap = {}
}
/**
 * A doubly linked list-based Least Recently Used (LRU) cache. Will keep most
 * recently used items while discarding least recently used items when its limit
 * is reached.
 *
 * Licensed under MIT. Copyright (c) 2016 Rasmus Andersson <http://hunch.se/>,
 * Ben Woosley. See README.md for details.
 *
 * Illustration of the design:
 *
 *       entry             entry             entry             entry
 *       ______            ______            ______            ______
 *      | head |.newer => |      |.newer => |      |.newer => | tail |
 *      |  A   |          |  B   |          |  C   |          |  D   |
 *      |______| <= older.|______| <= older.|______| <= older.|______|
 *
 *  removed  <--  <--  <--  <--  <--  <--  <--  <--  <--  <--  <--  added
 */
A doubly linked list-based Least Recently Used (LRU) cache. Will keep most
recently used items while discarding least recently used items when its limit
is reached.

Licensed under MIT. Copyright (c) 2016 Rasmus Andersson ,
Ben Woosley.

Illustration of the design.




A doubly linked list - based Least Recently Used ( LRU ) cache . Will keep most recently used items while discarding least recently used items when its limit is reached . Licensed under MIT . Copyright ( c ) 2016 Rasmus Andersson Ben Woosley . Illustration of the design .
function LRUCache (limit) {
  this.size = 0
  this.limit = limit
  this._keymap = {}
}
function LRUCache ( limit ) { this . size = 0 this . limit = limit this . _keymap = { } }
A doubly linked list-based Least Recently Used (LRU) cache.
A doubly linked list - based Least Recently Used ( LRU ) cache .
// Current size of the cache. (Read-only). // Maximum number of items this cache can hold.