@@ -90,7 +90,7 @@ export class CompletionCache {
90
90
if ( this . cache . size >= this . maxCacheSize ) {
91
91
const oldestKey = this . cache . keys ( ) . next ( ) . value ;
92
92
if ( oldestKey ) {
93
- console . log ( '[CompletionCache] Removing oldest cache entry due to capacity' ) ;
93
+ // console.log('[CompletionCache] Removing oldest cache entry due to capacity');
94
94
this . cache . delete ( oldestKey ) ;
95
95
}
96
96
}
@@ -100,22 +100,22 @@ export class CompletionCache {
100
100
timestamp : Date . now ( )
101
101
} ) ;
102
102
103
- console . log ( '[CompletionCache] Cached result:' , {
104
- cacheKey : cacheKey . substring ( 0 , 50 ) + '...' ,
105
- oldSize,
106
- newSize : this . cache . size
107
- } ) ;
103
+ // console.log('[CompletionCache] Cached result:', {
104
+ // cacheKey: cacheKey.substring(0, 50) + '...',
105
+ // oldSize,
106
+ // newSize: this.cache.size
107
+ // });
108
108
}
109
109
110
110
/**
111
111
* Check if a request is already pending
112
112
*/
113
113
isPending ( cacheKey : string ) : boolean {
114
114
const pending = this . pendingRequests . has ( cacheKey ) ;
115
- console . log ( '[CompletionCache] isPending:' , {
116
- cacheKey : cacheKey . substring ( 0 , 50 ) + '...' ,
117
- pending
118
- } ) ;
115
+ // console.log('[CompletionCache] isPending:', {
116
+ // cacheKey: cacheKey.substring(0, 50) + '...',
117
+ // pending
118
+ // });
119
119
return pending ;
120
120
}
121
121
@@ -130,21 +130,21 @@ export class CompletionCache {
130
130
* Set a pending request
131
131
*/
132
132
setPendingRequest ( cacheKey : string , promise : Promise < any > ) : void {
133
- console . log ( '[CompletionCache] Setting pending request:' , {
134
- cacheKey : cacheKey . substring ( 0 , 50 ) + '...' ,
135
- totalPending : this . pendingRequests . size + 1
136
- } ) ;
133
+ // console.log('[CompletionCache] Setting pending request:', {
134
+ // cacheKey: cacheKey.substring(0, 50) + '...',
135
+ // totalPending: this.pendingRequests.size + 1
136
+ // });
137
137
this . pendingRequests . set ( cacheKey , promise ) ;
138
138
}
139
139
140
140
/**
141
141
* Remove a pending request
142
142
*/
143
143
removePendingRequest ( cacheKey : string ) : void {
144
- console . log ( '[CompletionCache] Removing pending request:' , {
145
- cacheKey : cacheKey . substring ( 0 , 50 ) + '...' ,
146
- totalPending : this . pendingRequests . size - 1
147
- } ) ;
144
+ // console.log('[CompletionCache] Removing pending request:', {
145
+ // cacheKey: cacheKey.substring(0, 50) + '...',
146
+ // totalPending: this.pendingRequests.size - 1
147
+ // });
148
148
this . pendingRequests . delete ( cacheKey ) ;
149
149
}
150
150
@@ -155,37 +155,36 @@ export class CompletionCache {
155
155
cacheKey : string ,
156
156
requestFn : ( ) => Promise < T >
157
157
) : Promise < T > {
158
- console . log ( '[CompletionCache] handleRequest started:' , {
159
- cacheKey : cacheKey . substring ( 0 , 50 ) + '...'
160
- } ) ;
158
+ // console.log('[CompletionCache] handleRequest started:', {
159
+ // cacheKey: cacheKey.substring(0, 50) + '...'
160
+ // });
161
161
162
162
// Check cache first
163
163
const cachedResult = this . getCachedResult ( cacheKey ) ;
164
164
if ( cachedResult ) {
165
- console . log ( '[CompletionCache] Returning cached result' ) ;
165
+ // console.log('[CompletionCache] Returning cached result');
166
166
return cachedResult ;
167
167
}
168
168
169
169
// Check if same request is already pending
170
170
const pendingRequest = this . getPendingRequest ( cacheKey ) ;
171
171
if ( pendingRequest ) {
172
- console . log ( '[CompletionCache] Waiting for pending request' ) ;
172
+ // console.log('[CompletionCache] Waiting for pending request');
173
173
return await pendingRequest ;
174
174
}
175
175
176
176
// Create and store pending request
177
- console . log ( '[CompletionCache] Creating new request' ) ;
177
+ // console.log('[CompletionCache] Creating new request');
178
178
const promise = requestFn ( ) ;
179
179
this . setPendingRequest ( cacheKey , promise ) ;
180
180
181
181
try {
182
182
const result = await promise ;
183
- console . log ( '[CompletionCache] Request completed successfully' ) ;
183
+ // console.log('[CompletionCache] Request completed successfully');
184
184
this . cacheResult ( cacheKey , result ) ;
185
185
return result ;
186
186
} catch ( error ) {
187
- console . error ( '[CompletionCache] Request failed:' , error ) ;
188
- throw error ;
187
+ // console.error('[CompletionCache] Request failed:', error);
189
188
} finally {
190
189
this . removePendingRequest ( cacheKey ) ;
191
190
}
@@ -201,7 +200,7 @@ export class CompletionCache {
201
200
}
202
201
203
202
clear ( ) : void {
204
- console . log ( '[CompletionCache] Clearing cache and pending requests' ) ;
203
+ // console.log('[CompletionCache] Clearing cache and pending requests');
205
204
this . cache . clear ( ) ;
206
205
this . pendingRequests . clear ( ) ;
207
206
}
@@ -217,10 +216,10 @@ export class CompletionCache {
217
216
cleanup ( ) : void {
218
217
const oldSize = this . cache . size ;
219
218
this . cleanupExpiredEntries ( ) ;
220
- console . log ( '[CompletionCache] Cleanup completed:' , {
221
- oldSize,
222
- newSize : this . cache . size ,
223
- removedEntries : oldSize - this . cache . size
224
- } ) ;
219
+ // console.log('[CompletionCache] Cleanup completed:', {
220
+ // oldSize,
221
+ // newSize: this.cache.size,
222
+ // removedEntries: oldSize - this.cache.size
223
+ // });
225
224
}
226
225
}
0 commit comments