How to use
var CacheTool = ;var cache = duplicate: false //default false, if true, will create a no expiration cache for this key expired: null //default null, ms debug sync_key;//sync_key defaul '_cacheSync', if you want to refresh the cache, you can add ?{sync_key}=1 in url cache; var test_cache1 = cache; app;
You also can set multiple cache in one route, like
app.get('/', test_cache1, test_cache2, function(req, res, next){})
Cache scheme in express-cache-tool
- MemoryCache -
cache.use(MemoryCache)
- FileCache -
cache.use(FileCache)
- RedisCache - base on ioredis
Use RedisCache
redisCache = ;//if set redis and the first parameter is null, use a already exists redis connet, must be base on ioredis cache;
Custom cache scheme
var scheme = { //return promise } { //return promise }cache;