MCPcopy Create free account
hub / github.com/continuedev/continue / initKey

Method initKey

core/util/LruCache.ts:8–29  ·  view source on GitHub ↗
(key: string)

Source from the content-addressed store, hash-verified

6 ) {}
7
8 async initKey(key: string) {
9 // Maintain LRU
10 const index = this.items.findIndex((item) => item[0] === key);
11
12 if (index < 0) {
13 // Calculate info for new file
14 const value: V | null = await this.calculateValue(key);
15
16 if (value === null) {
17 return;
18 }
19
20 this.items.push([key, value]);
21 if (this.items.length > this.N) {
22 this.items.shift();
23 }
24 } else {
25 // Move to end of array, since it was recently used
26 const [item] = this.items.splice(index, 1);
27 this.items.push(item);
28 }
29 }
30
31 get(key: string): V | undefined {
32 return this.items.find((item) => item[0] === key)?.[1];

Callers 3

initializeForFileMethod · 0.80
constructorMethod · 0.80
LruCache.test.tsFile · 0.80

Calls 1

pushMethod · 0.65

Tested by

no test coverage detected