* @param {number|string} key * @param {T} payload The payload to cache.
(key, payload)
| 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. |
no test coverage detected