interface-cacher
A simple interface cacher based on ioredis.
JSDoc
Table of Contents
constructor
Parameters
payload
get
使用redis为接口加缓存
Parameters
payload
Object
Examples
说明:以给getShops接口加缓存为例要点:executor为一个返回bluebird 的promisegetShops接口如下:const getShops = { if type === 0 return Promise; return Promise;}; 使用方式:const Cacher = ; const cacher = ; const payload = key: 'getShops' executor: getShops expire: 100; cache ;
Returns Promise<Object> 缓存中数据(击中) 或executor返回数据(未击中)
delete
删除指定缓存
Parameters
key
string 要删除key