gh-badges/lib/lru-cache.js
function heuristic() {
    if (this.type === typeEnum.unit) {
      // Remove the excess.
      return Math.max(0, this.cache.size - this.capacity)
    } else if (this.type === typeEnum.heap) {
      if (getHeapSize() >= this.capacity) {
        console.log('LRU HEURISTIC heap:', getHeapSize())
        // Remove half of them.
        return this.cache.size >> 1
      } else {
        return 0
      }
    } else {
      console.error(`Unknown heuristic '${this.type}' for LRU cache.`)
      return 1
    }
  }
function heuristic() {
    if (this.type === typeEnum.unit) {
      // Remove the excess.
      return Math.max(0, this.cache.size - this.capacity)
    } else if (this.type === typeEnum.heap) {
      if (getHeapSize() >= this.capacity) {
        console.log('LRU HEURISTIC heap:', getHeapSize())
        // Remove half of them.
        return this.cache.size >> 1
      } else {
        return 0
      }
    } else {
      console.error(`Unknown heuristic '${this.type}' for LRU cache.`)
      return 1
    }
  }
function heuristic ( ) { if ( this . type === typeEnum . unit ) { // Remove the excess. return Math . max ( 0 , this . cache . size - this . capacity ) } else if ( this . type === typeEnum . heap ) { if ( getHeapSize ( ) >= this . capacity ) { console . log ( 'LRU HEURISTIC heap:' , getHeapSize ( ) ) // Remove half of them. return this . cache . size >> 1 } else { return 0 } } else { console . error ( ` ${ this . type } ` ) return 1 } }
Returns the number of elements to remove if we're past the limit.
Returns the number of elements to remove if we re past the limit .