@@ -44,7 +44,7 @@ export class CustomCacheService {
4444 const methodOverride = async ( ...args : unknown [ ] ) => {
4545 const result = async ( ) => await methodRef . apply ( instance , args ) ;
4646
47- return this . getOrSetCache ( { customKey, options , result , args } ) ;
47+ return this . getOrSetCache ( customKey , args , options , result ) ;
4848 } ;
4949
5050 Object . defineProperty ( instance , methodName , {
@@ -75,17 +75,12 @@ export class CustomCacheService {
7575 return customKey + JSON . stringify ( args ) ;
7676 }
7777
78- async getOrSetCache ( {
79- options,
80- args,
81- result : _result ,
82- customKey,
83- } : {
84- options : CustomCacheOptions ;
85- args : unknown [ ] ;
86- result : ( ) => Promise < unknown > ;
87- customKey : string ;
88- } ) {
78+ async getOrSetCache (
79+ customKey : string ,
80+ args : unknown [ ] ,
81+ options : CustomCacheOptions ,
82+ resultFn : ( ) => Promise < unknown > ,
83+ ) {
8984 const { key : cacheKey = customKey , ttl = Infinity , logger } = options ;
9085 const argsAddedKey = this . buildCacheKey ( cacheKey , args ) ;
9186
@@ -94,7 +89,7 @@ export class CustomCacheService {
9489 return cachedValue ;
9590 }
9691
97- const result = await _result ( ) ;
92+ const result = await resultFn ( ) ;
9893 await this . setCache ( argsAddedKey , result , ttl , logger ) ;
9994
10095 return result ;
0 commit comments