{"id":19621287,"url":"https://github.com/commenthol/map-lru","last_synced_at":"2026-02-28T14:31:57.420Z","repository":{"id":47089440,"uuid":"113657223","full_name":"commenthol/map-lru","owner":"commenthol","description":"\"Least Recently Used\" (LRU) cache compatible to ES6 Map","archived":false,"fork":false,"pushed_at":"2024-08-14T14:29:41.000Z","size":27,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-02T12:39:18.899Z","etag":null,"topics":["cache","es6","least-recently-used","lru-cache","map"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/commenthol.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-12-09T09:19:24.000Z","updated_at":"2024-08-14T14:29:44.000Z","dependencies_parsed_at":"2024-11-03T00:02:56.697Z","dependency_job_id":"dd880763-2914-4c43-ac0d-e9d1baf7166b","html_url":"https://github.com/commenthol/map-lru","commit_stats":{"total_commits":24,"total_committers":1,"mean_commits":24.0,"dds":0.0,"last_synced_commit":"6c840ac3998ed4d16a8dd209e214840fbbc92242"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commenthol%2Fmap-lru","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commenthol%2Fmap-lru/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commenthol%2Fmap-lru/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/commenthol%2Fmap-lru/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/commenthol","download_url":"https://codeload.github.com/commenthol/map-lru/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247878021,"owners_count":21011158,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cache","es6","least-recently-used","lru-cache","map"],"created_at":"2024-11-11T11:22:15.341Z","updated_at":"2025-10-30T18:37:49.904Z","avatar_url":"https://github.com/commenthol.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MapLRU\n\n\u003e \"Least Recently Used\" (LRU) cache compatible to ES6 Map\n\n[![NPM version](https://badge.fury.io/js/map-lru.svg)](https://www.npmjs.com/package/map-lru/)\n[![Build Status](https://app.travis-ci.com/commenthol/map-lru.svg?branch=master)](https://app.travis-ci.com/commenthol/map-lru)\n[![Coverage Status](https://coveralls.io/repos/github/commenthol/map-lru/badge.svg?branch=master)](https://coveralls.io/github/commenthol/map-lru?branch=master)\n\nUseful for caching with limited memory usage.\nAPI compatible with built-in [Map][] object.\n\n## Install\n\n```\n$ npm install map-lru\n```\n\n## Usage\n\n```js\nimport MapLRU from 'map-lru' // ES5\n// const MapLRU = require('map-lru') // commonJs\nconst cache = new MapLRU(10)\n\ncache.set('♥', '♥♥♥')\n\ncache.has('♥');\n//=\u003e true\ncache.get('♥');\n//=\u003e '♥♥♥'\ncache.last\n//=\u003e '♥'\ncache.size\n//=\u003e 1\n```\n\n\n## API\n\n### new MapLRU(maxSize)\n\nCreates a new instance\n\n**Parameters**\n\n- `maxSize` **[Number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** max. size of the LRU cache.\n\n----\n\n_Additional methods_\n\n- `last`\n\n  Returns the last accessed key.\n\n  Returns **Any**\n\n- `peek(key)`\n\n  Get an item without marking it as recently used.\n\n  **Parameters**\n\n  - `key` **Any**\n\n- `keysAccessed()`\n\n  keys in order of access - last one is most recently used one.\n\n  Returns **Iterator** Iterator object\n\n----\n\n_Default [Map][] methods_\n\n- [`size`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/size)\n\n- [`get(key)`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/get)\n\n- [`set(key, value)`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/set)\n\n- [`has(key)`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/has)\n\n- [`delete(key)`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/delete)\n\n- [`clear()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/clear)\n\n- [`keys()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/keys)\n\n- [`values()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/values)\n\n- [`entries()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/entries)\n\n- [`forEach()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/forEach)\n\n- [`[Symbol.iterator]`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set/@@iterator)\n\n## License\n\n[Unlicense](https://unlicense.org)\n\n[Map]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcommenthol%2Fmap-lru","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcommenthol%2Fmap-lru","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcommenthol%2Fmap-lru/lists"}