{"id":16363132,"url":"https://github.com/e0ipso/localstoragecache","last_synced_at":"2026-03-11T17:01:44.046Z","repository":{"id":18168322,"uuid":"21276975","full_name":"e0ipso/LocalStorageCache","owner":"e0ipso","description":"Javascript wrapper around HTML5 localStorage with auto expiration capabilities.","archived":false,"fork":false,"pushed_at":"2014-07-02T09:04:35.000Z","size":204,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-11T01:26:22.879Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"alibaba/packer-provider","license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/e0ipso.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":"2014-06-27T13:41:01.000Z","updated_at":"2020-10-10T19:03:11.000Z","dependencies_parsed_at":"2022-07-10T07:18:34.820Z","dependency_job_id":null,"html_url":"https://github.com/e0ipso/LocalStorageCache","commit_stats":null,"previous_names":["mateu-aguilo-bosch/localstoragecache"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/e0ipso/LocalStorageCache","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/e0ipso%2FLocalStorageCache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/e0ipso%2FLocalStorageCache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/e0ipso%2FLocalStorageCache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/e0ipso%2FLocalStorageCache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/e0ipso","download_url":"https://codeload.github.com/e0ipso/LocalStorageCache/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/e0ipso%2FLocalStorageCache/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":27675463,"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-12-12T02:00:06.775Z","response_time":129,"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":"2024-10-11T02:26:35.565Z","updated_at":"2025-12-12T03:21:18.848Z","avatar_url":"https://github.com/e0ipso.png","language":"JavaScript","readme":"[![Build Status](https://travis-ci.org/mateu-aguilo-bosch/LocalStorageCache.svg?branch=master)](https://travis-ci.org/mateu-aguilo-bosch/LocalStorageCache)\nLocalStorageCache\n=================\n\n**Minimal** Javascript wrapper around HTML5 localStorage with auto expiration\ncapabilities.\n\n## Installation\nYou can install this by:\n  - Cloning this repo and using the `local-storage-expirable.min.js` in the\n    `dist` folder.\n  - Doing `bower install LocalStorageCache`. Then run `grunt` (see the\n    _Minification and Testing_ section).\n\n## Minification and Testing\nYou can minify the source files by running `grunt` while in the library folder.\nIf you don't have the dependencies, run `npm install` first. The result files\nwill be stored in the `dist` folder.\n\nYou can test the library by running `npm test`. This will check for JSHint\nnotices and it will run the QUnit tests in a PhantomJS browser.\n\n## Usage\n\n```js\nvar storage = new LocalStorageCache(options);\n\n// Set a variable.\nstorage.set('key', {\n  foo: 'bar'\n});\n\n// Get a variable.\nstorage.get('key');\n```\n\n### Options\n#### LocalStorageWrapper\nYou can pass several options to the LocalStorageWrapper constructor. An object\nhaving:\n  - prefix: the prefix used to namespace the key values under the current\n  - object instance.\n  - notify: an object containing a list of events to trigger: 'setItem',\n    'removeItem', 'getItem' and 'listItems'.\n\n```js\nvar storage, config = {\n  prefix: 'root.namespace1',\n  notify: {\n    setItem: true,\n    getItem: false,\n    removeItem: true,\n    listItems: false,\n  }\n};\n\n// Create the object instance.\nstorage = new LocalStorageWrapper(config);\n```\n\n#### LocalStorageCache\nYou can pass several options to the LocalStorageCache constructor. The\nconfiguration object containing all the keys for the LocalStorageWrapper object\ninstantiation and the following extra keys:\n\n  - expiration: An object containing:\n\n    * expire: {bool} TRUE to expire objects, FALSE to keep them.\n    * interval: {int} Number of seconds during which the object is valid.\n\n```js\nvar expirableStorage, config = {\n  prefix: 'root.expirable.namespace2',\n  notify: {\n    setItem: true,\n    getItem: false,\n    removeItem: true,\n    listItems: false,\n  },\n  expiration: {\n    expire: true,\n    // 5 minutes.\n    interval: 300\n  }\n};\n\n// Create the object instance.\nexpirableStorage = new LocalStorageCache(config);\n\n// You can access the LocalStorageWrapper instance.\nconsole.debug(expirableStorage.storage);\n```\n\n### Dependencies\nNone. You don't need anything else to work with the LocalStorageCache or\nLocalStorageWrapper libraries.\n\nIf you install the [EventEmitter](https://github.com/Wolfy87/EventEmitter)\nlibrary you will get notifications for free. These events are triggered when an\noperation is made. Just use to subscribe to the following events:\n\n  * `local-storage-set`. Will get as a context: the storage prefix, the key and the value to set.\n  * `local-storage-get`. Will get as a context: the storage prefix and the key.\n  * `local-storage-remove`. Will get as a context: the storage prefix and the key.\n  * `local-storage-list`. Will get as a context: the storage prefix.\n\nExample:\n\n```js\nvar events = new EventEmitter();\nevents.on('local-storage-set', function (context) {\n  console.debug('LocalStorageWrapper: variable set');\n  console.debug(context);\n});\n\n// …\n\nstorage.set('my-foo-key', 'Hello World.');\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fe0ipso%2Flocalstoragecache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fe0ipso%2Flocalstoragecache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fe0ipso%2Flocalstoragecache/lists"}