MCPcopy Create free account
hub / github.com/ampproject/amphtml / constructor

Method constructor

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

* @param {number} capacity

(capacity)

Source from the content-addressed store, hash-verified

8 * @param {number} capacity
9 */
10 constructor(capacity) {
11 /** @private @const {number} */
12 this.capacity_ = capacity;
13
14 /** @private {number} */
15 this.size_ = 0;
16
17 /**
18 * An incrementing counter to define the last access.
19 * @private {number}
20 */
21 this.access_ = 0;
22
23 /** @private {{[key: (number|string)]: {payload: T, access: number}}} */
24 this.cache_ = map();
25 }
26
27 /**
28 * Returns whether key is cached.

Callers

nothing calls this directly

Calls 1

mapFunction · 0.90

Tested by

no test coverage detected