{"id":20514221,"url":"https://github.com/webreflection/basic-lru","last_synced_at":"2025-10-07T20:26:54.805Z","repository":{"id":65993113,"uuid":"238272667","full_name":"WebReflection/basic-lru","owner":"WebReflection","description":"A fast and lightweight Map based LRU implementation.","archived":false,"fork":false,"pushed_at":"2020-02-07T09:38:00.000Z","size":20,"stargazers_count":21,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-14T00:11:26.769Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/WebReflection.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}},"created_at":"2020-02-04T18:10:27.000Z","updated_at":"2023-07-25T11:09:49.000Z","dependencies_parsed_at":"2024-02-01T17:57:46.065Z","dependency_job_id":null,"html_url":"https://github.com/WebReflection/basic-lru","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WebReflection%2Fbasic-lru","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WebReflection%2Fbasic-lru/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WebReflection%2Fbasic-lru/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WebReflection%2Fbasic-lru/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/WebReflection","download_url":"https://codeload.github.com/WebReflection/basic-lru/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248799954,"owners_count":21163404,"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":[],"created_at":"2024-11-15T21:15:26.538Z","updated_at":"2025-10-07T20:26:49.770Z","avatar_url":"https://github.com/WebReflection.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# basic-lru\n\n\u003csup\u003e**Social Media Photo by [Mr Cup / Fabien Barral](https://unsplash.com/@iammrcup) on [Unsplash](https://unsplash.com/)**\u003c/sup\u003e\n\n[![Build Status](https://travis-ci.com/WebReflection/basic-lru.svg?branch=master)](https://travis-ci.com/WebReflection/basic-lru) [![Coverage Status](https://coveralls.io/repos/github/WebReflection/basic-lru/badge.svg?branch=master)](https://coveralls.io/github/WebReflection/basic-lru?branch=master)\n\nA fast and lightweight, as in [684 bytes](https://unpkg.com/basic-lru), Map based LRU implementation.\n\n```js\nimport LRU from 'basic-lru';\nconst LRU = require('basic-lru');\n// https://unpkg.com/basic-lru to have LRU globally\n\n// new LRU(maxSize)\nconst lru = new LRU(100);\n\n// new LRU({max}) or new LRU({maxSize})\nconst lru = new LRU({max: 1000});\n\n// new LRU({maxAge}) in milliseconds\nconst lru = new LRU({maxAge: 1000});\n\n// variants\nconst lru = new LRU({max: 100, maxAge: 1000});\nconst lru = new LRU({maxSize: 100, maxAge: 1000});\n```\n\n### About\n\nThis module is a drop-in replacement for any [Map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map) instance, and it's mostly 100% compatible with [lru](https://github.com/chriso/lru), [lru-cache](https://github.com/isaacs/node-lru-cache), [quick-lru](https://github.com/sindresorhus/quick-lru), and [lru-map](https://github.com/bchociej/lru-map) modules.\n\nDifferently from other modules, this one has the least amount of LOC, zero dependencies, and it's based on _ES2015_ class capability to extend the native `Map`.\n\n\n### The Map Extend Differences\n\nThe only difference from a real Map, beside implementing a classic LRU cache, is the `peek(key)` method, to access an entry without flagging its access time anyhow, and borrowed from other libraries, plus a constructor, also borrowed from other libraries, that accepts either an integer, or an options object with `max`, or `maxSize`, and a `maxAge` property, where all of these are optional too.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebreflection%2Fbasic-lru","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwebreflection%2Fbasic-lru","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebreflection%2Fbasic-lru/lists"}