@@ -23,6 +23,7 @@ export class RuntimeCacheAdapter implements KvAdapter {
23
23
24
24
async mget < Data > ( ...keys : string [ ] ) {
25
25
const startTime = now ( ) ;
26
+ this . logger ( `DEBUG: MGET called for keys: [${ keys . join ( ', ' ) } ]` ) ;
26
27
27
28
// First check memory cache for immediate reads
28
29
const memoryStartTime = now ( ) ;
@@ -67,13 +68,21 @@ export class RuntimeCacheAdapter implements KvAdapter {
67
68
}
68
69
69
70
try {
71
+ this . logger ( `DEBUG: Attempting to get key "${ key } " from runtime cache` ) ;
70
72
const result = await cache . get ( key ) ;
73
+
74
+ if ( result !== null && result !== undefined ) {
75
+ this . logger ( `DEBUG: ✓ Runtime cache HIT for key "${ key } " - got value: ${ typeof result } ` ) ;
76
+ } else {
77
+ this . logger ( `DEBUG: ✗ Runtime cache MISS for key "${ key } " - got: ${ result } ` ) ;
78
+ }
71
79
72
80
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
73
81
return result as Data | null ;
74
82
} catch ( error ) {
75
83
// eslint-disable-next-line no-console
76
84
console . warn ( `Runtime cache get failed for key ${ key } :` , error ) ;
85
+ this . logger ( `DEBUG: ✗ Runtime cache ERROR for key "${ key } ": ${ error } ` ) ;
77
86
78
87
return null ;
79
88
}
@@ -120,6 +129,7 @@ export class RuntimeCacheAdapter implements KvAdapter {
120
129
121
130
async set < Data > ( key : string , value : Data , opts ?: SetCommandOptions ) {
122
131
const startTime = now ( ) ;
132
+ this . logger ( `DEBUG: SET called for key: "${ key } " with value type: ${ typeof value } ` ) ;
123
133
124
134
// Convert options for memory cache (it only supports TTL as 'ex' field)
125
135
const memoryStartTime = now ( ) ;
@@ -149,10 +159,14 @@ export class RuntimeCacheAdapter implements KvAdapter {
149
159
}
150
160
151
161
// Call cache.set with options if provided, otherwise call without options
162
+ this . logger ( `DEBUG: Setting key "${ key } " in runtime cache with options: ${ JSON . stringify ( runtimeCacheOptions ) } ` ) ;
163
+
152
164
if ( Object . keys ( runtimeCacheOptions ) . length > 0 ) {
153
165
await cache . set ( key , value , runtimeCacheOptions ) ;
166
+ this . logger ( `DEBUG: ✓ Runtime cache SET completed for key "${ key } " WITH options` ) ;
154
167
} else {
155
168
await cache . set ( key , value ) ;
169
+ this . logger ( `DEBUG: ✓ Runtime cache SET completed for key "${ key } " WITHOUT options` ) ;
156
170
}
157
171
158
172
runtimeSuccess = true ;
0 commit comments