{"id":21557075,"url":"https://github.com/shenfe/lru","last_synced_at":"2025-03-18T03:24:03.690Z","repository":{"id":143886643,"uuid":"120636111","full_name":"shenfe/lru","owner":"shenfe","description":"♻️ LRU (Least Recently Used) cache.","archived":false,"fork":false,"pushed_at":"2018-05-15T03:14:36.000Z","size":13,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-11T23:34:10.151Z","etag":null,"topics":["cache","lru","lru-cache"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shenfe.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":"2018-02-07T15:52:56.000Z","updated_at":"2018-05-15T03:14:37.000Z","dependencies_parsed_at":null,"dependency_job_id":"f243d41a-fb51-4fa4-8dbc-b404b5973271","html_url":"https://github.com/shenfe/lru","commit_stats":{"total_commits":13,"total_committers":2,"mean_commits":6.5,"dds":0.3846153846153846,"last_synced_commit":"9608933fa84d52678e8f3e994c6f82c9a7565c43"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shenfe%2Flru","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shenfe%2Flru/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shenfe%2Flru/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shenfe%2Flru/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shenfe","download_url":"https://codeload.github.com/shenfe/lru/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244148342,"owners_count":20406160,"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","lru","lru-cache"],"created_at":"2024-11-24T08:10:52.272Z","updated_at":"2025-03-18T03:24:03.667Z","avatar_url":"https://github.com/shenfe.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# *lru* \u003ca href=\"https://www.npmjs.com/package/llrruu\"\u003e\u003cimg src=\"https://img.shields.io/npm/v/llrruu.svg\"\u003e\u003c/a\u003e\n\n♻️ LRU (Least Recently Used) Cache.\n\n* single file ✨\n* browser✔\n* Node.js✔\n* \u003cdel\u003edependencies\u003c/del\u003e\n* \u003cdel\u003ebabel\u003c/del\u003e\n* \u003cdel\u003epolyfills\u003c/del\u003e\n\n## Installation\n\n```bash\n$ npm install --save llrruu\n```\n\n## Usage\n\n### import\n\n```js\nconst LRU = require('llrruu');\n```\n\n### create\n\nThe module exported is both a constructor and a factory function. It accepts either a number or an object.\n\n```js\nconst lru1 = new LRU(10);\nconst lru2 = LRU(10);\nconst lru3 = LRU({\n    maxSize: 10,\n    onEvict: (key, val) =\u003e console.log(`${key} is being kicked out, with its value `, val)\n});\n```\n\n### api\n\n```js\nlru.set('a', 1);    // will affect the order\nlru.get('a');       // will affect the order\nlru.val('a', 1);\nlru.val('a');\nlru.remove('a');\nlru.keys();\nlru.size();\nlru.clear();\n```\n\n## Test\n\n```bash\n$ npm test\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshenfe%2Flru","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshenfe%2Flru","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshenfe%2Flru/lists"}