【文件属性】:
文件名称:lazy-cache:惰性缓存,过期时异步自动重置缓存
文件大小:5KB
文件格式:ZIP
更新时间:2021-05-20 12:48:32
JavaScript
惰性缓存
节点的惰性内存高速缓存,过期时异步自动重置高速缓存
安装
npm i lazycache --save
用法
lazyCache()
使用工厂方法初始化缓存对象:
var defaultCacheTime = 300000 ; // 300000 ms = 5 min
var cache = require ( 'lazyCache' ) ( defaultCacheTime ) ;
如果defaultCacheTime < 0 ,则将返回一个noCache对象,该对象提供相同的API,但不缓存任何内容。
cache.get(key)
从缓存中获取价值
键:缓存键
cache . set ( 'key' , 'my cache value' ) ;
cache.set(key,val [,cacheTime] [,reseter])
将值设置到缓存中
键:缓存键
【文件预览】:
lazy-cache-master
----.travis.yml(37B)
----index.js(3KB)
----package.json(844B)
----test()
--------test.js(3KB)
----LICENSE(1KB)
----.gitignore(526B)
----README.md(1KB)
----.jshintrc(419B)
网友评论
- 不是我想要的