NQ-CACHE
function cache
Features
- IE8+
- Support for Typescript
Document
Installation
Install npm package
npm install nq-cache
Use pureFuncMemoryCache
add.js
{ return a + b} const addCache =
app.js
// execute and cache the result // Get results directly from the cache
use promiseMemoryCache
request.js
{ return { }} const requestCache =
app.js
// execute and cache the result
use promiseSessionStorageCache
request.js
{ return { }} const requestCache =
app.js
// execute and cache the result
CDN
Contains only nq-cache
<!-- Use the latest version --><!-- or specify a version -->
For more other methods, you can view example
if the browser does not support Promise or JSON, you should do a polyfill
<!--[if lt IE 8]> <script type="text/javascript" src="https://cdn.bootcss.com/json2/20160511/json2.min.js"></script><![endif]-->
Methods
- pureFuncMemoryCache
- promiseMemoryCache
- promiseSessionStorageCache
- clearCache
- argToKey
Local development
- Installation dependencies
npm install
- Testing
npm test
- Build
npm run build
Flow
npm run flow
ESLint
npm run lint
- Update documentation
npm run doc
- Run the test page
npm run buildnpm run example Then open it with a browserHttp://localhost:5000/examples/
- Release
npm version [new version]npm run buildnpm publish