5.3.0-alpha.0 • Published 2 years ago
miniprogram-network-cache v5.3.0-alpha.0
miniprogram-network-cache
The cache lib of miniprogram-network
请求缓存
import {CacheOperator} from 'miniprogram-network-cache';
const cacheRequest = CacheOperator.createHandler(wx.request);
cacheRequest({url:'https://miniprogram-network.newfuture.cc'})
cacheRequest({url:'https://miniprogram-network.newfuture.cc'}) // 请求将被合并
import {CacheOperator} from 'miniprogram-network-cache';
const cacheRequest = new CacheOperator(wx.request,{
/**
* 缓存时间
*/
expire: number;
/**
* 结果缓存条件
* @param res 结果
*/
resultCondition:(res: TRes)=>boolean;
/**
* 参数缓存条件,无则全部缓存
* @param options request/downloadFile参数
* @returns 返回string键值,无返回值时不进行缓存和请求合并
*/
keyBuilder?(options: TOptions): string | void | null;
});
配置
expire
缓存过期时间单位ms,为0时不缓存只合并请求resultCondition
结果缓存条件, 默认条件isOkResult
keyBuilder
自定义缓存键, 返回非真值
则不缓存, 默认使用defaultKeyBuilder
export
defaultKeyBuilder(opts)
isOkResult(res)
CacheOperator
5.3.0-alpha.0
2 years ago
5.2.0
4 years ago
5.1.11-alpha.0
4 years ago
5.1.6
5 years ago
5.1.5
5 years ago
5.0.2-beta
5 years ago
4.5.1
5 years ago
4.5.0
5 years ago
4.4.7
5 years ago
4.4.6
5 years ago
4.2.5
5 years ago
4.2.3
5 years ago
4.1.0
5 years ago
3.3.1
5 years ago
3.2.4
5 years ago
1.1.1
5 years ago
1.1.0
5 years ago
1.0.2
5 years ago
1.0.2-alpha.0
5 years ago
1.0.1-alpha.0
5 years ago
1.0.0-alpha.0
5 years ago
0.2.6-alpha.0
5 years ago
0.2.5
5 years ago
0.2.4
5 years ago
0.2.4-alpha.0
5 years ago
0.2.3-alpha.0
5 years ago
0.2.2-alpha.0
5 years ago
0.2.1-alpha.0
5 years ago
0.2.0-alpha.0
5 years ago
0.1.2
5 years ago
0.1.2-alpha.0
5 years ago
0.1.1-alpha.0
5 years ago
0.1.0-alpha.0
5 years ago