* Returns cached content. * @param {string} identifier unique name for the resource * @param {string | null} etag etag of the resource * @returns {Data} cached content
(identifier, etag)
| 182 | * @returns {Data} cached content |
| 183 | */ |
| 184 | get(identifier, etag) { |
| 185 | const info = this.itemInfo.get(identifier); |
| 186 | this._addRequest(identifier); |
| 187 | if (info === undefined) { |
| 188 | return; |
| 189 | } |
| 190 | if (info.etag !== etag) return null; |
| 191 | info.lastAccess = Date.now(); |
| 192 | const loc = info.location; |
| 193 | if (loc === -1) { |
| 194 | return info.freshValue; |
| 195 | } |
| 196 | if (!this.content[loc]) { |
| 197 | return; |
| 198 | } |
| 199 | return /** @type {PackContent} */ (this.content[loc]).get(identifier); |
| 200 | } |
| 201 | |
| 202 | /** |
| 203 | * Updates value using the provided identifier. |
no test coverage detected