MCPcopy
hub / github.com/tensorflow/tfjs / put

Method put

tfjs-layers/src/utils/executor_utils.ts:42–50  ·  view source on GitHub ↗

* Put the entry into the cache. If the key already existed, mark the key as * used recently.

(key: string, value: T)

Source from the content-addressed store, hash-verified

40 * used recently.
41 */
42 public put(key: string, value: T): void {
43 if (this.cache.has(key)) {
44 this.cache.delete(key);
45 } else if (this.cache.size >= this.maxEntries) {
46 const keyToDelete = this.cache.keys().next().value;
47 this.cache.delete(keyToDelete);
48 }
49 this.cache.set(key, value);
50 }
51
52 /**
53 * Get the MaxEntries of the cache.

Callers 3

executeFunction · 0.80
databaseActionMethod · 0.80

Calls 4

hasMethod · 0.80
deleteMethod · 0.80
nextMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected