8000 GitHub - biancamihai/cacheJS: Small lib for storing contextual cache
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

biancamihai/cacheJS

 
 

Repository files navigation

cacheJS

Small JS lib for caching:

  • Use array as key for storing cache instead of string ( {blogId:1,type:'view'} )
  • Clear cache using context (clear blog posts of an author)
  • Support localStorage, array, cookies (WIP, only localStorage and array are available at the moment)

See the project homepage.

Installation

Using Bower:

bower install cache-js

Or grab the file source (minified).

Usage

Save cache:

cacheJS.set({blogId:1,type:'view},'<h1>Blog 1</h1>');
cacheJS.set({blogId:2,type:'view},'<h1>Blog 2</h1>', null, {author:'hoangnd'});
cacheJS.set({blogId:3,type:'view},'<h1>Blog 3</h1>', 3600, {author:'hoangnd',categoryId:2});

Retrieve cache:

cacheJS.get({blogId: 1,type: 'view'});

Flush cache

cacheJS.removeByKey({blogId: 1,type: 'view'});
cacheJS.removeByKey({blogId: 2,type: 'view'});

cacheJS.removeByContext({author:'hoangnd'});

Switch provider

cacheJS.use('array');
cacheJS.use('array').set({blogId:1},'<h1>Blog 1</h1>')};

For advanced usage, see the documentation.

Documentation

Start with docs/INDEX.md.

MIT. See LICENSE.txt in this directory.

About

Small lib for storing contextual cache

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 94.6%
  • CSS 5.4%
2A9C
0