build: 1.6.6-build02

This commit is contained in:
手瓜一十雪
2024-07-20 10:28:47 +08:00
parent c4e7bfed78
commit c414ec0cee
2 changed files with 18 additions and 6 deletions

View File

@@ -89,7 +89,7 @@ export function CacheClassFuncAsync(ttl: number = 3600 * 1000, customKey: string
}
return logExecutionTime;
}
export function CacheClassFuncAsyncExtend(ttl: number = 3600 * 1000, customKey: string = '', checker: any = (_data: any) => { return true; }) {
export function CacheClassFuncAsyncExtend(ttl: number = 3600 * 1000, customKey: string = '', checker: any = (...data: any[]) => { return true; }) {
//console.log('CacheClassFuncAsync', ttl, customKey);
function logExecutionTime(target: any, methodName: string, descriptor: PropertyDescriptor) {
//console.log('logExecutionTime', target, methodName, descriptor);
@@ -108,7 +108,7 @@ export function CacheClassFuncAsyncExtend(ttl: number = 3600 * 1000, customKey:
}
// const start = Date.now();
const result = await originalMethod.apply(this, args);
if (!checker(result)) {
if (!checker(...args, result)) {
return result;//丢弃缓存
}
// const end = Date.now();