MCPcopy Create free account
hub / github.com/chhoumann/quickadd / set

Method set

src/utils/FieldSuggestionCache.ts:67–88  ·  view source on GitHub ↗

* Set cached values for a field * @param fieldName The field name * @param values The values to cache * @param cacheKey Additional key for filtering (e.g., folder path)

(fieldName: string, values: Set<string>, cacheKey?: string)

Source from the content-addressed store, hash-verified

65 * @param cacheKey Additional key for filtering (e.g., folder path)
66 */
67 set(fieldName: string, values: Set<string>, cacheKey?: string): void {
68 const key = this.makeKey(fieldName, cacheKey);
69
70 // Limit the number of values per entry
71 const limitedValues = new Set<string>();
72 let count = 0;
73 for (const value of values) {
74 if (count >= this.MAX_VALUES_PER_ENTRY) break;
75 limitedValues.add(value);
76 count++;
77 }
78
79 // Check if we need to evict old entries
80 if (this.cache.size >= this.MAX_CACHE_ENTRIES && !this.cache.has(key)) {
81 this.evictOldestEntries(1);
82 }
83
84 this.cache.set(key, {
85 values: limitedValues,
86 timestamp: Date.now(),
87 });
88 }
89
90 /**
91 * Evict the oldest cache entries

Callers 15

makeDestinationAppFunction · 0.45
getSmartDefaultsMethod · 0.45
deepCloneFallbackFunction · 0.45
setFunction · 0.45
buildPickerOrderingDepsFunction · 0.45
analyzeVariationsMethod · 0.45
parseInlineFieldsMethod · 0.45

Calls 3

makeKeyMethod · 0.95
evictOldestEntriesMethod · 0.95
addMethod · 0.80

Tested by 1

makeDestinationAppFunction · 0.36