@@ -108,7 +108,7 @@ export class CacheClient {
108108 * @param {string } key - cache key
109109 * @param {Promise } request - http request to put in the pending object
110110 */
111- #addPendingRequest = < T = unknown > ( key : string , request : ( ) => SafeWrapAsync < Error , T > , ttl : number ) => {
111+ #addPendingRequest< T = unknown > ( key : string , request : ( ) => SafeWrapAsync < Error , T > , ttl : number ) {
112112 const pending = ( async ( ) : SafeWrapAsync < Error , T > => {
113113 const [ errWrapped , wrapped ] = await safeWrapAsync ( ( ) => request ( ) ) ;
114114 if ( errWrapped ) {
@@ -129,18 +129,14 @@ export class CacheClient {
129129
130130 this . #pending. set ( key , pending ) ;
131131 return pending ;
132- } ;
132+ }
133133
134134 /**
135135 * Pass a request to the cache
136136 * @param {string } key - cache key
137137 * @param {Function } res - http request and data returned.
138138 */
139- public get = < T = unknown > (
140- key : string ,
141- res : ( ) => SafeWrapAsync < Error , T > ,
142- ttl = this . #ttl,
143- ) : SafeWrapAsync < Error , T > => {
139+ public get < T = unknown > ( key : string , res : ( ) => SafeWrapAsync < Error , T > , ttl = this . #ttl) : SafeWrapAsync < Error , T > {
144140 const cachedData = this . #getItem< CacheItem < T > > ( key ) ;
145141 if ( cachedData ) {
146142 return Promise . resolve ( [ null , cachedData . data ] ) ;
@@ -152,7 +148,7 @@ export class CacheClient {
152148 }
153149
154150 return this . #addPendingRequest( key , res , ttl ) ;
155- } ;
151+ }
156152
157153 /**
158154 * Constructs a deterministic, unambiguous cache key based on URL + headers.
@@ -179,13 +175,13 @@ export class CacheClient {
179175 * cleanup that does housekeeping every 30 seconds, removing
180176 * invalid cache items to prevent unecessary memory usage;
181177 */
182- #cleanup = ( ) => {
178+ #cleanup( ) {
183179 clearInterval ( this . #intervalId) ;
184180
185181 this . #intervalId = setInterval ( ( ) => {
186182 for ( const key of this . #cache. keys ( ) ) {
187183 this . #getItem( key ) ;
188184 }
189185 } , this . #cleanupInterval) ;
190- } ;
186+ }
191187}
0 commit comments