{"id":21488535,"url":"https://github.com/dsabre/local-storage-cache","last_synced_at":"2025-03-17T10:43:04.913Z","repository":{"id":41950622,"uuid":"325040148","full_name":"dsabre/local-storage-cache","owner":"dsabre","description":"Npm module for use the local storage as a cache","archived":false,"fork":false,"pushed_at":"2023-09-08T07:32:09.000Z","size":40,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-03-05T00:34:40.835Z","etag":null,"topics":["cache","javascript-library","localstorage","storage"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/dsabre.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-12-28T14:55:33.000Z","updated_at":"2021-11-12T09:37:38.000Z","dependencies_parsed_at":"2024-11-21T00:01:38.367Z","dependency_job_id":"d335f5fb-ae56-4831-bfce-421c2c2268e7","html_url":"https://github.com/dsabre/local-storage-cache","commit_stats":{"total_commits":36,"total_committers":3,"mean_commits":12.0,"dds":0.2777777777777778,"last_synced_commit":"3d609a9f9c789e8e36ebc2d913a24814d9906cae"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dsabre%2Flocal-storage-cache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dsabre%2Flocal-storage-cache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dsabre%2Flocal-storage-cache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dsabre%2Flocal-storage-cache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dsabre","download_url":"https://codeload.github.com/dsabre/local-storage-cache/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243769985,"owners_count":20345217,"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","javascript-library","localstorage","storage"],"created_at":"2024-11-23T14:10:02.544Z","updated_at":"2025-03-17T10:43:04.894Z","avatar_url":"https://github.com/dsabre.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Local Storage Cache\n\nNpm module for use the local storage as a cache.\n\n[![Version](https://img.shields.io/npm/v/@dsabre/local-storage-cache?style=for-the-badge)](https://www.npmjs.com/package/@dsabre/local-storage-cache)\n[![License: MIT](https://img.shields.io/npm/l/@dsabre/local-storage-cache?registry_uri=https%3A%2F%2Fregistry.npmjs.org\u0026style=for-the-badge)](https://github.com/dsabre/local-storage-cache/blob/main/LICENSE)\n[![Downloads](https://img.shields.io/npm/dw/@dsabre/local-storage-cache?style=for-the-badge)](https://www.npmjs.com/package/@dsabre/local-storage-cache)\n[![GitHub issues](https://img.shields.io/github/issues-raw/dsabre/local-storage-cache?style=for-the-badge)](https://github.com/dsabre/local-storage-cache/issues)\n[![Dependencies](https://img.shields.io/librariesio/release/npm/@dsabre/local-storage-cache?style=for-the-badge)](https://www.npmjs.com/package/@dsabre/local-storage-cache)\n\n\n## Dependencies\n[Moment.js](https://momentjs.com/)\n\n\n## Installation\n\n```bash\n  npm i @dsabre/local-storage-cache\n```\n    \n    \n## Methods\nThe class exposes these methods:\n\n#### `setBucket(bucketName: string)`\nSet the bucket name for the cache, if not used the default bucket name cache is used\n\n---\n\n#### `set(cid: string, value: any, expirationInMinutes: number)`\nSet a cache item in bucket.\n- **cid**: is the cache id for this item,\n- **value**: contain what you want to be saved,\n- **expirationInMinutes**: pass here the amount of minutes while you cache item is valid.\n\n---\n\n#### `get(cid: string)`\nGet a cache item from bucket.\n- **cid**: is the cache id for this item.\n\n---\n\n#### `remove(cid: string)`\nRemove a cache item from bucket.\n- **cid**: is the cache id for this item.\n\n---\n\n#### `flush()`\nFlush the entire bucket from local storage.\n\n---\n\n#### `flushExpired()`\nFlush expired items from bucket.\n\n\n## Thanks\n\nThis class is inspired by:\n\n[lscache](https://www.npmjs.com/package/lscache)\n\n\n## License\n\n[MIT](https://choosealicense.com/licenses/mit/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdsabre%2Flocal-storage-cache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdsabre%2Flocal-storage-cache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdsabre%2Flocal-storage-cache/lists"}