{"id":16776331,"url":"https://github.com/kurtextrem/js-sieve","last_synced_at":"2025-04-10T20:14:05.433Z","repository":{"id":215088441,"uuid":"738104963","full_name":"kurtextrem/js-sieve","owner":"kurtextrem","description":"SIEVE in JS, a modern efficient cache algorithm that is simpler than LRU","archived":false,"fork":false,"pushed_at":"2024-02-25T12:05:20.000Z","size":18,"stargazers_count":16,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-24T17:55:15.502Z","etag":null,"topics":["cache","fifo","lru","sieve","sieve-cache"],"latest_commit_sha":null,"homepage":"","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/kurtextrem.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":"2024-01-02T12:39:29.000Z","updated_at":"2024-12-23T22:06:51.000Z","dependencies_parsed_at":"2025-02-18T00:31:50.396Z","dependency_job_id":"729ede68-7606-4fc4-a459-b2cf2fdcded0","html_url":"https://github.com/kurtextrem/js-sieve","commit_stats":null,"previous_names":["kurtextrem/js-sieve"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kurtextrem%2Fjs-sieve","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kurtextrem%2Fjs-sieve/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kurtextrem%2Fjs-sieve/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kurtextrem%2Fjs-sieve/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kurtextrem","download_url":"https://codeload.github.com/kurtextrem/js-sieve/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248008630,"owners_count":21032556,"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","fifo","lru","sieve","sieve-cache"],"created_at":"2024-10-13T07:09:35.445Z","updated_at":"2025-04-10T20:14:05.411Z","avatar_url":"https://github.com/kurtextrem.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003ejs-sieve\u003c/h1\u003e\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://opensource.org/licenses/MIT\"\u003e\u003cimg src=\"https://img.shields.io/badge/license-MIT-_red.svg\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\nThis is a modern cache implementation, **inspired** by the [SIEVE is Simpler than LRU: an Efficient Turn-Key Eviction Algorithm for Web Caches](https://junchengyang.com/publication/nsdi24-SIEVE.pdf) (NSDI'24) paper. It offers state-of-the-art efficiency and scalability compared to other LRU-based cache algorithms.\n\n\u003csub\u003e\u003csup\u003eBased on the [Go](https://github.com/scalalang2/golang-fifo) implementation (JS implementation is without mutex). All credits to @scalalang2.\u003c/sup\u003e\u003c/sub\u003e\n\n## Basic Usage\n```ts\nimport { Sieve } from 'js-sieve';\n\nconst cache = new Sieve\u003cstring, string\u003e(1000);\ncache.set(\"hello\", \"world\")\nconst [v, _] = cache.get(\"hello\");\nconsole.log(v) // =\u003e \"world\"\n```\n\n## Benchmark\nThe benchmark result were obtained using [go-cache-benchmark](https://github.com/scalalang2/go-cache-benchmark), all credits to [golang-fifo](https://github.com/scalalang2/golang-fifo):\n\n```\nitemSize=500000, workloads=7500000, cacheSize=0.10%, zipf's alpha=0.99, concurrency=16\n\n      CACHE      | HITRATE | MEMORY  |   QPS   |  HITS   | MISSES\n-----------------+---------+---------+---------+---------+----------\n  sieve          | 47.66%  | 0.09MiB | 2508361 | 3574212 | 3925788\n  tinylfu        | 47.37%  | 0.11MiB | 2269542 | 3552921 | 3947079\n  s3-fifo        | 47.17%  | 0.18MiB | 1651619 | 3538121 | 3961879\n  slru           | 46.49%  | 0.11MiB | 2201350 | 3486476 | 4013524\n  s4lru          | 46.09%  | 0.12MiB | 2484266 | 3456682 | 4043318\n  two-queue      | 45.49%  | 0.17MiB | 1713502 | 3411800 | 4088200\n  clock          | 37.34%  | 0.10MiB | 2370417 | 2800750 | 4699250\n  lru-groupcache | 36.59%  | 0.11MiB | 2206841 | 2743894 | 4756106\n  lru-hashicorp  | 36.57%  | 0.08MiB | 2055358 | 2743000 | 4757000\n```\n\n**For additional info about SIEVE**, head to [golang-fifo](https://github.com/scalalang2/golang-fifo). You'll find explanations why SIEVE is so good, why you should use it instead of FIFO/LRU, and things to consider before using it.\n\n## Contribution\nHow to run tests\n```bash\n$ npx esno test/index.mts\n```\n\nHow to run benchmark test\n```bash\n$ npx esno bench/index.mts\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkurtextrem%2Fjs-sieve","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkurtextrem%2Fjs-sieve","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkurtextrem%2Fjs-sieve/lists"}