前端缓存工具cache-manager
Install
npm install cache-manager
Basic Usage
set(key, val, {
ttl: ttl}, cb) // * see note below
get(key, cb)
del(key, cb)
mset(key1, val1, key2, val2, {
ttl: ttl}, cb) // set several keys at once
mget(key1, key2, key3, cb) // get several keys at once
// * Note that depending on the underlying store, you may be able to pass the
// ttl as the third param, like this:
set(key, val, ttl, cb)
// ... or pass no ttl at all:
set(key, val, cb)
My Example
const cacheManager = require('cache-manager')
const memoryCache