{"id":21553193,"url":"https://github.com/bbvaengineering/ember-storages","last_synced_at":"2025-03-18T02:34:45.925Z","repository":{"id":21849284,"uuid":"94200420","full_name":"BBVAEngineering/ember-storages","owner":"BBVAEngineering","description":"An ember-cli addon to store data in storages (cache, local, memory, session)","archived":false,"fork":false,"pushed_at":"2022-12-07T23:24:33.000Z","size":2928,"stargazers_count":1,"open_issues_count":23,"forks_count":0,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-02-25T04:35:06.782Z","etag":null,"topics":["cache","ember-addon","ember-cli-addon","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/BBVAEngineering.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-06-13T10:22:43.000Z","updated_at":"2020-02-20T08:24:16.000Z","dependencies_parsed_at":"2023-01-11T21:22:40.422Z","dependency_job_id":null,"html_url":"https://github.com/BBVAEngineering/ember-storages","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BBVAEngineering%2Fember-storages","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BBVAEngineering%2Fember-storages/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BBVAEngineering%2Fember-storages/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BBVAEngineering%2Fember-storages/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BBVAEngineering","download_url":"https://codeload.github.com/BBVAEngineering/ember-storages/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244144519,"owners_count":20405462,"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","ember-addon","ember-cli-addon","storage"],"created_at":"2024-11-24T07:09:47.166Z","updated_at":"2025-03-18T02:34:45.905Z","avatar_url":"https://github.com/BBVAEngineering.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ember-storages\n\n[![Build Status](https://travis-ci.com/BBVAEngineering/ember-storages.svg?branch=master)](https://travis-ci.com/BBVAEngineering/ember-storages)\n[![GitHub version](https://badge.fury.io/gh/BBVAEngineering%2Fember-storages.svg)](https://badge.fury.io/gh/BBVAEngineering%2Fember-storages)\n[![NPM version](https://badge.fury.io/js/ember-storages.svg)](https://badge.fury.io/js/ember-storages)\n[![Dependency Status](https://david-dm.org/BBVAEngineering/ember-storages.svg)](https://david-dm.org/BBVAEngineering/ember-storages)\n[![codecov](https://codecov.io/gh/BBVAEngineering/ember-storages/branch/master/graph/badge.svg)](https://codecov.io/gh/BBVAEngineering/ember-storages)\n[![Greenkeeper badge](https://badges.greenkeeper.io/BBVAEngineering/ember-storages.svg)](https://greenkeeper.io/)\n[![Ember Observer Score](https://emberobserver.com/badges/ember-storages.svg)](https://emberobserver.com/addons/ember-storages)\n\nAn [ember-cli addon](http://www.ember-cli.com/) to store data in storages (cache, local, memory, session).\n\n## Information\n\n[![NPM](https://nodei.co/npm/ember-storages.png?downloads=true\u0026downloadRank=true)](https://nodei.co/npm/ember-storages/)\n\n## Install in ember-cli application\n\nIn your application's directory:\n\n  ember install ember-storages\n\n## Usage\n\nThis service is an overall cache which saves any type of data, by synchronizing them in memory and in localStorage.\nIn both reading and writing, MemoryStorage takes precedence over LocalStorage.\nIn the reading, when it is detected that the data has expired, it is deleted.\n\nExample:\n\n```javascript\n\nthis.get('cache').set('foo', 'bar');\nthis.get('cache').get('foo'); // bar\n\n```\n\nIt can be used from any file where this service is injected (by default in every routes and controllers).\n\n### Data validity\n\nBy default, the validity time of these data is 10 minutes.\nWe can change this time by passing the amount of minutes or by passing the metadata object:\n\n```javascript\n\nthis.get('cache').set('foo', 'bar', moment().add(10, 'minutes'));  // 10 min\nthis.get('cache').set('foo', 'bar', {\n  expire: moment().add(10, 'minutes'),   // 10 min\n});\n\n```\n\n### Data structure\n\nThe data is saved with the follow structure:\n\n```javascript\n\nfoo: {\n  meta: {\n       updated: 1429806124,     \u003c\u003c last updated time\n        expire: 1429806124       \u003c\u003c time of expiration\n    },\n    data: \"bar\"\n}\n\n```\n\n'meta.expire' is the timestamp in which time the data will be expired.\n'data' is the storaged value.\n\n### Bindings\n\nWe can bind a property of controller and a value in cache.\nExample:\n\n```javascript\n\nexport default Ember.Controller.extend({\n    foo: Ember.computed.alias('this.cache.foo'),\n     actions: {\n        changeFoo() {\n            this.set('foo', 'bar2');\n        },\n    }\n    ...\n}\n\n```\n\n## Contribute\n\nIf you want to contribute to this addon, please read the [CONTRIBUTING.md](CONTRIBUTING.md).\n\n## Versioning\n\nWe use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/BBVAEngineering/ember-storages/tags).\n\n## Authors\n\nSee the list of [contributors](https://github.com/BBVAEngineering/ember-storages/graphs/contributors) who participated in this project.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbbvaengineering%2Fember-storages","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbbvaengineering%2Fember-storages","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbbvaengineering%2Fember-storages/lists"}