FlexiCache
Lightweight auto-balancing cache handler with zero dependencies.
FlexiCache automatically balance caches by expiration time, frequency of data accesses, access timeout, maximum stack size and/or memory limit.
Supported Platforms:
- Browser
- Node.js
Supported Module Definitions:
- AMD (RequireJS, Xone)
- CommonJS (Node.js)
- Closure (Xone)
- Global (window)
All Features:
- Auto-cleanup cache by:
- Expiration time
- Frequency of data accesses
- Access timeout
- Maximum size (stack)
- Memory limit
- Allows free combination of all the above options
- Debug infos & statistics
- Save / Load dump
Optional Plugins: (actually unreleased)
- Redis API Adapter
- Filesystem Plugin (HTML5)
- Filesystem Plugin (Node.js)
- LocalStorage Plugin (HTML5)
Installation
HTML / Javascript
...
Node.js
npm install flexicache
In your code include as follows:
var FlexiCache = ;
Or pass in options when requiring:
var cache = ;
AMD
var FlexiCache = ;
Usage (API)
Create a new cache
var cache = ;
alternatively you can also use:
var cache = FlexiCache;
Create a new cache with custom options
FlexiCache.create(options)
var cache = // default values: expire: 60 * 60 * 1000 // 1 hour size: 1000 auto: true timeout: false memory: false;
Add items to a cache
Cache.add_(id, *)
cache;
add more complex objects:
cache;
clone and add objects:
cache;
Update item of the cache
Cache.update(id, *)
cache;
clone and update objects:
cache;
Remove item to the cache
Cache.remove(id)
cache;
Destroy the cache
cache;
Initialize the cache
Cache.init(options)
cache;
Get info
cache;
Returns information about the cache, e.g.:
Optimize / Cleanup cache
cache;
Author FlexiCache: Thomas Wilkerling
License: Apache 2.0 License