zoo-cache
Universal caching solution
Features
- Customizable inner data store
- Customizable inner data region
- Support cache item expire and expire callback
- Events on operating cache item
Installation
$ npm install zoo-cache
Data store
Store is the inner core data storage. We can implement it to store data in memory or database etc. There is already a MemoryStore builtin in this solution. Will use MemoryStore when user doesn't specified the store option.
var cache = ;// change default storecache;
Data region
Region is a subset of the data store.
var cache = ;// animals setvar animals = cache;// or specified a storevar animals = cache;
API
Friendly and simply api.
var cache = ;// animals setvar animals = cache;// api listanimals; // get or set inner store of current regionanimals;animals;animals;animals;animalsall;animals;animalsclear;
Caching expire
User can specify a absolute expire date to cache item and a expire callback also available.
// full apianimals;// exampleanimals;
Store events
All data changes events of the inner data store.
var store = animals;store;store;store;
Tests
$ npm install$ npm test