{"id":25738515,"url":"https://github.com/anzerr/storage.ts","last_synced_at":"2026-05-20T10:17:30.830Z","repository":{"id":49166113,"uuid":"234576556","full_name":"anzerr/storage.ts","owner":"anzerr","description":"Util to store data used in a service","archived":false,"fork":false,"pushed_at":"2022-01-21T16:45:18.000Z","size":385,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-25T11:07:14.041Z","etag":null,"topics":["data","nodejs","storage","typescript","util"],"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/anzerr.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}},"created_at":"2020-01-17T15:26:40.000Z","updated_at":"2022-01-21T16:37:34.000Z","dependencies_parsed_at":"2022-09-13T17:11:48.030Z","dependency_job_id":null,"html_url":"https://github.com/anzerr/storage.ts","commit_stats":null,"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"purl":"pkg:github/anzerr/storage.ts","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anzerr%2Fstorage.ts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anzerr%2Fstorage.ts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anzerr%2Fstorage.ts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anzerr%2Fstorage.ts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/anzerr","download_url":"https://codeload.github.com/anzerr/storage.ts/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anzerr%2Fstorage.ts/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262521848,"owners_count":23323868,"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":["data","nodejs","storage","typescript","util"],"created_at":"2025-02-26T07:31:37.580Z","updated_at":"2026-05-20T10:17:25.802Z","avatar_url":"https://github.com/anzerr.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n### `Intro`\n![GitHub Actions status | publish](https://github.com/anzerr/storage.ts/workflows/publish/badge.svg)\n\n// explain\n\n#### `Install`\n``` bash\nnpm install --save git+https://git@github.com/anzerr/storage.ts.git\nnpm install --save @anzerr/storage.ts\n```\n\n### `Example`\n``` javascript\nimport {Counter, Ref, PoolCounter, Cache, NetworkMap} from 'storage.ts';\n\nconst count = new Counter();\ncount.duration('test', 200);\nfor (let i = 0; i \u003c runs; i++) {\n    count.add('test', 1);\n}\nconsole.log(count.get('test'), count.reduce('test'));\n            \nconst ref = new Ref();\nconsole.log(ref.get('cat'), ref.get('dog'), ref.get('cat'), ref.getRef(2)) // 1, 2, 1, 'dog'\n\nconst pool = new PoolCounter({\n    timeout: 2000, // how long added data exists \n    interval: 100 // how long the pool be drained\n});\nfor (let i = 0; i \u003c 1000; i++) {\n    pool.add('test', 'cat', 1);\n    pool.add('test', 'dog', 1);\n}\nconsole.log(pool.get());\nsetTimeout(() =\u003e {\n    console.log(pool.get());\n}, 1000);\n\nconst cache = new Cache();\nconsole.log(cache.get('test')); // null\ncache.set('test', 'tests', 1000);\nconsole.log(cache.get('test')); // tests\ncache.clear('test');\nconsole.log(cache.get('test')); // null\n\nconst map = new NetworkMap({\n    timeout: 2000, // when the data added should time out and be dropped\n    interval: 100 // at what interval should the pooled data be drained and added to it's map\n});\nmap.add('cat', 'dog', 100);\nmap.add('cat', 'dog', 1000);\nmap.add('cat', 'egg', 100);\nconsole.log(map.get());\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanzerr%2Fstorage.ts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanzerr%2Fstorage.ts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanzerr%2Fstorage.ts/lists"}