File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1599,10 +1599,11 @@ class LocalStackMemoryMCP {
15991599 if ( cached . hit && cached . entry ) {
16001600 this . sessionCacheHits ++ ;
16011601 this . sessionTokensSaved += cached . tokensSaved ;
1602- logger . debug ( 'Cache hit' , {
1603- tool : name ,
1604- tokensSaved : cached . tokensSaved ,
1605- } ) ;
1602+ const total = this . sessionCacheHits + this . sessionCacheMisses ;
1603+ const rate = ( ( this . sessionCacheHits / total ) * 100 ) . toFixed ( 0 ) ;
1604+ console . error (
1605+ `[cache] HIT ${ name } — saved ~${ cached . tokensSaved } tokens (session: ${ this . sessionTokensSaved . toLocaleString ( ) } total, ${ rate } % hit rate)`
1606+ ) ;
16061607 const cachedResult = JSON . parse ( cached . entry . content ) ;
16071608 toolCall . result = cachedResult ;
16081609 toolCall . duration = Date . now ( ) - startTime ;
@@ -1925,7 +1926,16 @@ class LocalStackMemoryMCP {
19251926 if ( ! error && result && cacheKey ) {
19261927 try {
19271928 const serialized = JSON . stringify ( result ) ;
1928- this . contentCache . putByKey ( cacheKey , serialized , `tool:${ name } ` ) ;
1929+ const entry = this . contentCache . putByKey (
1930+ cacheKey ,
1931+ serialized ,
1932+ `tool:${ name } `
1933+ ) ;
1934+ if ( entry . hitCount === 0 ) {
1935+ console . error (
1936+ `[cache] STORE ${ name } — ~${ entry . tokenCount } tokens cached for future dedup`
1937+ ) ;
1938+ }
19291939 } catch {
19301940 // Cache store failure is non-fatal
19311941 }
You can’t perform that action at this time.
0 commit comments