Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vutran/js-caching
Client-side caching with JavaScript, HTML5 and shitty browser friendly.
https://github.com/vutran/js-caching
caching javascript localstorage
Last synced: 23 days ago
JSON representation
Client-side caching with JavaScript, HTML5 and shitty browser friendly.
- Host: GitHub
- URL: https://github.com/vutran/js-caching
- Owner: vutran
- License: mit
- Created: 2012-10-18T19:48:14.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2013-10-29T16:21:59.000Z (over 11 years ago)
- Last Synced: 2024-12-14T03:15:53.975Z (about 2 months ago)
- Topics: caching, javascript, localstorage
- Language: JavaScript
- Size: 146 KB
- Stars: 5
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
#JavaScript Caching
Provides an API for client-side caching via a JS variable on a page instance
or through the HTML5 localStorage/sessionStorage API#Storage Types
##JavaScript
This type of storage only lasts for a single page load instance.
##Session Storage
Useful for persistent page load instances. If the user refreshes
the browser or browse to another site and comes back, the stored
data is still there unless the cache timeout is met.##Local Storage
Same as sessionStorage but uses localStorage system to allow for
caching even when the browser is closed and reopened (where available)#Usage
##Set a value
cache.set('some_key', 'some_value_to_store');##Retrieve a stored value
va value = cache.get('some_key');
console.log(value); // returns "some_value_to_store"##Reset the cache
cache.reset();