service/lrucache.js
// Reading node gets removed from cache and written back into cache as new Head
Reading node gets removed from cache and written back into cache as new Head
Reading node gets removed from cache and written back into cache as new Head
read(key){
      if(this.map[key]){
        const value = this.map[key].value;
        this.remove(key)
        this.write(key, value);
        return value;
      }
    }
read ( key ) { if ( this . map [ key ] ) { const value = this . map [ key ] . value ; this . remove ( key ) this . write ( key , value ) ; return value ; } }
Reading node gets removed from cache and written back into cache as new Head
Reading node gets removed from cache and written back into cache as new Head
/* When reading node, remove the node from the cache
        ** it will become the new head node as it is the most recently used node
        **/ /* Once removed from the cache, reading node gets written into the cache as the new head node */