A simple and fast LRU cache using the native Map class.
npm install lru-map-cacheA simple and fast LRU cache using the native Map class.
npm install lru-map-cache
`Usage
`javascript
const LRUCache = require('lru-map-cache');const cache = new LRUCache(3);
cache.set('a', 1);
cache.set('b', 2);
cache.set('c', 3);
cache.set('d', 4);
cache.get('a'); // undefined
cache.get('b'); // 2
cache.get('c'); // 3
cache.get('d'); // 4
``Each time a get or set operation is performed, the corresponding key is deleted and re-inserted into the Map. This process ensures that the key is moved to the end of the Map, indicating its most recently used status.
When the cache reaches its maximum capacity, the first key in the Map (the least recently used key) is deleted to make space for new entries.