资 源 简 介
$cache module
A cache module for storing JSON like data in LocalStorage or IndexedDB(coming) easily.
Pure JavaScript no library required.
The script is useful for sharing data across scripts or pages. eg. store server side data as cache to reduce requests.
Usage
```
// store data to internal _cache object. Automatic create structure if key is undefined.
// can set multiple items in one go.
$cache({
set: {
"key": "abc",
"parent.subitem.subSubitem": 123
}
});
// get data. Returns data or null if undefined
$cache({get: "parent.subitem.subSubitem"});
// clear data value to ""
$cache({clear: "parent.subitem.subSubitem"});
// get back the whole _cache data object for debug purpose.
$cache("debug");
// clear all cache
$cache("clearAll");
```