{"id":20218284,"url":"https://github.com/z3ut/tlru-cache","last_synced_at":"2026-06-06T04:31:35.253Z","repository":{"id":143942508,"uuid":"151971460","full_name":"z3ut/tlru-cache","owner":"z3ut","description":"Time aware least recently used cache storage","archived":false,"fork":false,"pushed_at":"2018-10-07T18:18:42.000Z","size":46,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-13T22:28:27.018Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/z3ut.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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-10-07T18:18:27.000Z","updated_at":"2018-10-07T18:18:43.000Z","dependencies_parsed_at":null,"dependency_job_id":"10a828c7-56a5-4506-a870-3a0a657884b6","html_url":"https://github.com/z3ut/tlru-cache","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/z3ut%2Ftlru-cache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/z3ut%2Ftlru-cache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/z3ut%2Ftlru-cache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/z3ut%2Ftlru-cache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/z3ut","download_url":"https://codeload.github.com/z3ut/tlru-cache/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241655196,"owners_count":19998001,"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-14T06:37:54.391Z","updated_at":"2025-12-01T09:03:55.411Z","avatar_url":"https://github.com/z3ut.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"TLRU-Cache\n=\n\nTime aware least recently used cache store\n\n## Installation\n\n```\nnpm i tlru-cache\n```\n\n## Usage\n\n```typescript\nimport { TLRUCache } from 'tlru-cache';\n\nconst tlruCache =  new TLRUCache({\n  // optional values\n  maxStoreSize: 5,\n  timeToUseMs: 60 * 1000,\n});\n\nconst value = tlruCache.get('value', () =\u003e 42);\n// won't calculate again\nconst sameValue = tlruCache.get('value', () =\u003e 42);\n```\n\n## Documentation\n\n### Constructor object properties:\n\nName | Type | Default value | Description\n---|---|---|---\nmaxStoreSize | number | 1000 | Store capacity\nmaxAgeMs | number | 60 * 60 * 1000 (1 hour) | Record time to use in milliseconds. Put \u003c= 0 for non-expiring records.\n\n### Methods:\n\n```typescript\nget\u003cTKey, TValue\u003e(key: TKey, calculate: (key: TKey) =\u003e TValue, maxAgeMs: number = null): TValue\n```\n\n#### Arguments:\n\n* **key**: record key\n\n* **calculate**: function to get record. receive key as argument\n\n* **maxAgeMs**: record time to use. if presented, override constructor option\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fz3ut%2Ftlru-cache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fz3ut%2Ftlru-cache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fz3ut%2Ftlru-cache/lists"}