MCPcopy
hub / github.com/redpanda-data/console / get

Method get

frontend/src/utils/lazy-map.ts:33–48  ·  view source on GitHub ↗

* @description Returns the value corrosponding to key * @param key Key of the value * @param create An optional `create` method to use instead of `defaultCreate` to create missing values

(key: K, createFn?: (k: K) => V)

Source from the content-addressed store, hash-verified

31 * @param create An optional `create` method to use instead of `defaultCreate` to create missing values
32 */
33 get(key: K, createFn?: (k: K) => V): V {
34 const existing = super.get(key);
35 if (existing !== undefined) {
36 if (this.maxSize !== undefined) {
37 // Mark as most-recently-used so it survives eviction.
38 super.delete(key);
39 super.set(key, existing);
40 }
41 return existing;
42 }
43
44 const created = this.handleMiss(key, createFn);
45 this.set(key, created);
46 this.evictOldest();
47 return created;
48 }
49
50 private evictOldest(): void {
51 if (this.maxSize === undefined) {

Callers 15

config.test.tsxFile · 0.45
scheduleUnmountFunction · 0.45
AppFooterFunction · 0.45
countDescendantsFunction · 0.45
layoutDfsFunction · 0.45
computeTreeLayoutFunction · 0.45
mergeScannerFunction · 0.45
substituteScalarFunction · 0.45
groupByCategoryFunction · 0.45
TemplateGalleryGridFunction · 0.45

Calls 3

handleMissMethod · 0.95
evictOldestMethod · 0.95
setMethod · 0.80

Tested by 3

createMemoryStorageFunction · 0.36
makePagedHarnessFunction · 0.36
makePagedHarnessFunction · 0.36