{"id":30799177,"url":"https://github.com/partman7/rotating-cache","last_synced_at":"2025-10-14T01:38:52.312Z","repository":{"id":307312346,"uuid":"1029070381","full_name":"PartMan7/rotating-cache","owner":"PartMan7","description":"Quick JS/TS rotating cache","archived":false,"fork":false,"pushed_at":"2025-07-31T08:52:12.000Z","size":29,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-05T19:25:25.339Z","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/PartMan7.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,"zenodo":null}},"created_at":"2025-07-30T13:30:35.000Z","updated_at":"2025-07-31T10:35:51.000Z","dependencies_parsed_at":"2025-07-30T16:54:15.983Z","dependency_job_id":"d2b33ea2-fc7e-4909-9180-6e7a15ee57fa","html_url":"https://github.com/PartMan7/rotating-cache","commit_stats":null,"previous_names":["partman7/rotating-cache"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/PartMan7/rotating-cache","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PartMan7%2Frotating-cache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PartMan7%2Frotating-cache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PartMan7%2Frotating-cache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PartMan7%2Frotating-cache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PartMan7","download_url":"https://codeload.github.com/PartMan7/rotating-cache/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PartMan7%2Frotating-cache/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279017497,"owners_count":26086085,"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","status":"online","status_checked_at":"2025-10-13T02:00:06.723Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":"2025-09-05T19:08:45.003Z","updated_at":"2025-10-14T01:38:52.305Z","avatar_url":"https://github.com/PartMan7.png","language":"TypeScript","readme":"# rotating-cache\n\nQuick-and-dirty rotating cache for JS/TS. Caches a fixed amount of entries, and is pretty fast!\n\n## Installation\n\n```bash\n# Any of the following\nnpm install rotating-cache\nyarn add rotating-cache\nbun add rotating-cache\n```\n\n## Usage\n\n#### TypeScript\n\n```ts\nimport createCache from 'rotating-cache';\n\nconst lookup = createCache\u003cstring, string\u003e({\n\tcomputation: str =\u003e str.split('').reverse().join(''),\n});\n\nlookup('abc'); // 'cba', computed\nlookup('bca'); // 'acb', computed\nlookup('abc'); // 'cba', cached\nlookup('bca'); // 'acb', cached\n```\n\n#### JavaScript (ESM)\n\n```js\nimport createCache from 'rotating-cache';\n\nconst lookup = createCache({\n\tcomputation: str =\u003e str.split('').reverse().join(''),\n});\n```\n\n#### JavaScript (CJS)\n\n```js\nconst createCache = require('rotating-cache');\n\nconst lookup = createCache({\n\tcomputation: str =\u003e str.split('').reverse().join(''),\n});\n```\n\n### Caching\n\n`createCache` accepts `hash` and `cacheSize` as props. `hash` will take the given value and calculate a unique identifier from it (defaults to `String`) while `cacheSize` is the total size of cached entries.\n\nWhile caching, each entry is checked in two parallel caches. The older cache will be cycled out and replaced with the newer cache every time the newer cache is full.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpartman7%2Frotating-cache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpartman7%2Frotating-cache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpartman7%2Frotating-cache/lists"}