@@ -9,10 +9,10 @@ import { MirrorNodeClient } from './clients';
99import  {  IOpcode  }  from  './clients/models/IOpcode' ; 
1010import  {  IOpcodesResponse  }  from  './clients/models/IOpcodesResponse' ; 
1111import  constants ,  {  CallType ,  TracerType  }  from  './constants' ; 
12- import  {  RPC_LAYOUT ,  rpcMethod ,  rpcParamLayoutConfig ,  rpcParamValidationRules  }  from  './decorators' ; 
12+ import  {  cache ,   RPC_LAYOUT ,  rpcMethod ,  rpcParamLayoutConfig ,  rpcParamValidationRules  }  from  './decorators' ; 
1313import  {  predefined  }  from  './errors/JsonRpcError' ; 
1414import  {  CommonService  }  from  './services' ; 
15- import  {  CacheService  }  from  './services/cacheService/cacheService' ; 
15+ import  {  CACHE_LEVEL ,   CacheService  }  from  './services/cacheService/cacheService' ; 
1616import  { 
1717  BlockTracerConfig , 
1818  CallTracerResult , 
@@ -109,6 +109,7 @@ export class DebugImpl implements Debug {
109109    1 : {  type : ParamType . COMBINED_TRACER_TYPE ,  required : false  } , 
110110    2 : {  type : ParamType . TRACER_CONFIG ,  required : false  } , 
111111  } ) 
112+   @cache ( CacheService . getInstance ( CACHE_LEVEL . L1 ) ) 
112113  async  traceTransaction ( 
113114    transactionIdOrHash : string , 
114115    tracer : TracerType , 
@@ -152,6 +153,9 @@ export class DebugImpl implements Debug {
152153    1 : {  type : ParamType . TRACER_CONFIG_WRAPPER ,  required : false  } , 
153154  } ) 
154155  @rpcParamLayoutConfig ( RPC_LAYOUT . custom ( ( params )  =>  [ params [ 0 ] ,  params [ 1 ] ] ) ) 
156+   @cache ( CacheService . getInstance ( CACHE_LEVEL . L1 ) ,  { 
157+     skipParams : [ {  index : '0' ,  value : constants . NON_CACHABLE_BLOCK_PARAMS  } ] , 
158+   } ) 
155159  async  traceBlockByNumber ( 
156160    blockNumber : string , 
157161    tracerObject : BlockTracerConfig , 
@@ -171,20 +175,6 @@ export class DebugImpl implements Debug {
171175
172176      if  ( blockResponse  ==  null )  throw  predefined . RESOURCE_NOT_FOUND ( `Block ${ blockNumber }  ) ; 
173177
174-       const  cacheKey  =  `${ constants . CACHE_KEY . DEBUG_TRACE_BLOCK_BY_NUMBER } ${ blockResponse . number } ${ JSON . stringify (  
175-         tracerObject ,  
176-       ) }  `; 
177- 
178-       const  cachedTracerObject  =  await  this . cacheService . getAsync ( 
179-         cacheKey , 
180-         DebugImpl . traceBlockByNumber , 
181-         requestDetails , 
182-       ) ; 
183- 
184-       if  ( cachedTracerObject )  { 
185-         return  cachedTracerObject ; 
186-       } 
187- 
188178      const  timestampRangeParams  =  [ `gte:${ blockResponse . timestamp . from }  ,  `lte:${ blockResponse . timestamp . to }  ] ; 
189179
190180      const  contractResults : MirrorNodeContractResult [ ]  =  await  this . mirrorNodeClient . getContractResultWithRetry ( 
@@ -223,7 +213,6 @@ export class DebugImpl implements Debug {
223213            } ) , 
224214        ) ; 
225215
226-         await  this . cacheService . set ( cacheKey ,  result ,  DebugImpl . traceBlockByNumber ,  requestDetails ) ; 
227216        return  result ; 
228217      } 
229218
@@ -240,7 +229,6 @@ export class DebugImpl implements Debug {
240229            } ) , 
241230        ) ; 
242231
243-         await  this . cacheService . set ( cacheKey ,  result ,  DebugImpl . traceBlockByNumber ,  requestDetails ) ; 
244232        return  result ; 
245233      } 
246234
0 commit comments