{"id":17937801,"url":"https://github.com/xobotyi/node-tagged-cache","last_synced_at":"2026-01-21T20:34:12.375Z","repository":{"id":40751478,"uuid":"160865204","full_name":"xobotyi/node-tagged-cache","owner":"xobotyi","description":"✍️In-memory, performance-targeted caching module with ttl and tagging support.","archived":false,"fork":false,"pushed_at":"2023-01-07T05:05:06.000Z","size":1506,"stargazers_count":1,"open_issues_count":14,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-25T20:13:33.841Z","etag":null,"topics":["cache","inmemory","inmemory-cache","node","tagged","tagged-cache"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/xobotyi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"patreon":"xobotyi"}},"created_at":"2018-12-07T19:11:06.000Z","updated_at":"2023-01-26T10:16:57.000Z","dependencies_parsed_at":"2023-02-06T12:25:19.333Z","dependency_job_id":null,"html_url":"https://github.com/xobotyi/node-tagged-cache","commit_stats":{"total_commits":153,"total_committers":3,"mean_commits":51.0,"dds":0.196078431372549,"last_synced_commit":"342c7a9bbd3522efc0db5fff891c0b606d3003f8"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/xobotyi/node-tagged-cache","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xobotyi%2Fnode-tagged-cache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xobotyi%2Fnode-tagged-cache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xobotyi%2Fnode-tagged-cache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xobotyi%2Fnode-tagged-cache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xobotyi","download_url":"https://codeload.github.com/xobotyi/node-tagged-cache/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xobotyi%2Fnode-tagged-cache/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28642032,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-21T18:04:35.752Z","status":"ssl_error","status_checked_at":"2026-01-21T18:03:55.054Z","response_time":86,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["cache","inmemory","inmemory-cache","node","tagged","tagged-cache"],"created_at":"2024-10-28T23:07:51.564Z","updated_at":"2026-01-21T20:34:07.367Z","avatar_url":"https://github.com/xobotyi.png","language":"TypeScript","readme":"\u003ch1 align=\"center\"\u003enode-tagged-cache\u003c/h1\u003e\n\u003cp align=\"center\"\u003e\n\u003ca href=\"https://www.npmjs.com/package/node-tagged-cache\"\u003e\u003cimg src=\"https://img.shields.io/badge/npm-node--tagged--cache-brightgreen.svg?style=flat-square\"\u003e\u003c/a\u003e\n\u003ca href=\"https://www.npmjs.com/package/node-tagged-cache\"\u003e\u003cimg src=\"https://img.shields.io/npm/v/node-tagged-cache.svg?style=flat-square\"\u003e\u003c/a\u003e\n\u003ca href=\"https://www.npmjs.com/package/node-tagged-cache\"\u003e\u003cimg src=\"https://img.shields.io/travis/xobotyi/node-tagged-cache.svg?style=flat-square\"\u003e\u003c/a\u003e\n\u003ca href=\"https://www.npmjs.com/package/node-tagged-cache\"\u003e\u003cimg src=\"https://img.shields.io/npm/l/node-tagged-cache.svg?style=flat-square\"\u003e\u003c/a\u003e\n\u003ca href=\"https://www.npmjs.com/package/node-tagged-cache\"\u003e\u003cimg src=\"https://img.shields.io/npm/dt/node-tagged-cache.svg?style=flat-square\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n### Fast NodeJS in-memory caching with tagging\nProbably the fastest NodeJS caching system yet.  \nIt is much like memcached or redis but provides you with ability to set tags for cache entries and drop them all together when you need it.  \n\u003eNote: **this module does not clone stored arrays/objects and operates only with their refs.**\n\n### Performance\nAs the entries store `node-tagged-cache` uses [Map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map) due to it's total overperforming regular objects.\nAll below performance tests made on Win10, Intel I7 5820K, 16GB DDR4 RAM.  \nAll numbers are OPS (operations per second).  \n500000 rounds peer test.  \n\nstorage | set | get | check | delete\n--------|-----|-----|-------|-------\nobj | 3,846,153 | 12,820,512 | 14,285,714 | 11,111,111\nobjV2 | 4,237,288 | 13,888,888 | 14,285,714 | 15,151,515\nmap | 3,816,793 | 55,555,555 | 50,000,000 | 7,246,376\n\nThe other thing that appeared to be a real showstopper in terms of performance - `Date.now()` calls, which been used in cache itself and in cache controller. So intermediate timestamp cache was implemented, performance impact of which you can see below.  \nAnd, furthermore, below you can see  performance comparision with two most popular caching libs i know about.\n\u003eNote: node-cache is in `useClones: false,` mode, but cache-base always copies it's values;\n\nmodule | set | mset | get | mget | has | mhas\n-------|-----|------|-----|------|-----|-----\nTagged Cache (w/o timestamp) (w/o tags) | 1,179,245 | 2,463,054 | 1,510,574 | 2,717,391 | 1,533,742 | 2,392,344 \nTagged Cache (w/o timestamp) | 1,302,083 | 2,392,344 | 1,146,788 | 1,298,701 | 1,070,663 | 1,388,888\nTagged Cache (w/o tags) | 2,631,578 | 3,333,333 | 5,208,333 | 2,906,976 | 5,494,505 | 3,355,704\nTagged Cache | 2,976,190 | 3,378,378 | 1,845,018 | 1,436,781 | 1,976,284 | 1,529,051\nnode-cache | 284,900 | none | 1,312,335 | 1,098,901 | none | none\ncache-base | 507,614 | none | 892,857 | none | 5,319,148 | none\n \n\nYou can simply run performance tests on your own machine.\n```bash\nnode benchmarks/storage.js\nnode benchmarks/cache.js\n```\n\n### Install\n```bash\nnpm i node-tagged-cache\n```\n\n### Usage\n```javascript\nimport TaggedCache, {enableTimestampCache, disableTimestampCache} from \"node-tagged-cache\";\n// default module's export is already created instance of cache with default options\n// {\n//  defaultTTL: 600000, // 10m\n//  cleanupInterval: 60000, // 1m\n// }\n\nenableTimestampCache(); // this is not straight requirement but needed for performance improvement\n\nTaggedCache.mset({\n                    foo: \"bar\",\n                    baz: \"bax\"\n                },\n                3600000, // 1h\n                [\"awesomeTag\", \"moreAwesomeTag\"]);\nTaggedCache.mget([\"foo\", \"baz\"]); // { foo: \"bar\", baz: \"bax\" }\n\nTaggedCache.tags.drop(\"awesomeTag\");\nTaggedCache.mhas([\"foo\", \"baz\"]); // { foo: false, baz: false }\n\ndisableTimestampCache(); // before the script should exit;\n```\n","funding_links":["https://patreon.com/xobotyi"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxobotyi%2Fnode-tagged-cache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxobotyi%2Fnode-tagged-cache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxobotyi%2Fnode-tagged-cache/lists"}