MCPcopy
hub / github.com/ampproject/amphtml / put

Method put

src/core/data-structures/lru-cache.js:54–60  ·  view source on GitHub ↗

* @param {number|string} key * @param {T} payload The payload to cache.

(key, payload)

Source from the content-addressed store, hash-verified

52 * @param {T} payload The payload to cache.
53 */
54 put(key, payload) {
55 if (!this.has(key)) {
56 this.size_++;
57 }
58 this.cache_[key] = {payload, access: this.access_};
59 this.evict_();
60 }
61
62 /**
63 * Evicts the oldest cache entry, if we've exceeded capacity.

Callers 3

test-lru-cache.jsFile · 0.80
parseUrlWithAFunction · 0.80
fetchMethod · 0.80

Calls 2

hasMethod · 0.95
evict_Method · 0.95

Tested by

no test coverage detected