@@ -129,7 +129,7 @@ export function cache<Args extends any[], Result>(
129129 async ( key : string , signal : AbortSignal | undefined , span : TraceSpan , ...args : Args ) => {
130130 const timeStart = now ( ) ;
131131 let readCacheDuration = 0 ;
132- let _fetchDuration = 0 ;
132+ let fetchDuration = 0 ;
133133
134134 let result : readonly [ CacheEntry , string ] | null = null ;
135135 const tag = cacheDef . tag ?.( ...args ) ;
@@ -179,7 +179,7 @@ export function cache<Args extends any[], Result>(
179179 const upstream = await revalidate ( key , fallbackOps . signal , ...args ) ;
180180
181181 readCacheDuration = timeFetch - timeStart ;
182- _fetchDuration = now ( ) - timeFetch ;
182+ fetchDuration = now ( ) - timeFetch ;
183183 return [ upstream , 'fetch' ] as const ;
184184 } ,
185185
@@ -219,10 +219,18 @@ export function cache<Args extends any[], Result>(
219219 ) ;
220220 }
221221
222- const _totalDuration = now ( ) - timeStart ;
222+ const totalDuration = now ( ) - timeStart ;
223223
224224 // Log
225225 if ( process . env . SILENT !== 'true' ) {
226+ // biome-ignore lint/suspicious/noConsole: we want to log here
227+ console . log (
228+ `cache: ${ key } ${ cacheStatus } ${
229+ cacheStatus === 'hit' ? ` on ${ backendName } ` : ''
230+ } in total ${ totalDuration . toFixed ( 0 ) } ms, fetch in ${ fetchDuration . toFixed (
231+ 0
232+ ) } ms, read in ${ readCacheDuration . toFixed ( 0 ) } ms`
233+ ) ;
226234 }
227235
228236 if ( savedEntry . meta . revalidatesAt && savedEntry . meta . revalidatesAt < Date . now ( ) ) {
0 commit comments