* Processes the provided identifier. * @template T * @param {string} identifier the cache identifier * @param {Etag | null} etag the etag * @param {(callback: CallbackNormalErrorCache<T>) => void} computer function to compute the value if not cached * @param {CallbackNormalErrorCache<T>} c
(identifier, etag, computer, callback)
| 347 | * @returns {void} |
| 348 | */ |
| 349 | provide(identifier, etag, computer, callback) { |
| 350 | this.get(identifier, etag, (err, cacheEntry) => { |
| 351 | if (err) return callback(err); |
| 352 | if (cacheEntry !== undefined) return cacheEntry; |
| 353 | computer((err, result) => { |
| 354 | if (err) return callback(err); |
| 355 | this.store(identifier, etag, result, (err) => { |
| 356 | if (err) return callback(err); |
| 357 | callback(null, result); |
| 358 | }); |
| 359 | }); |
| 360 | }); |
| 361 | } |
| 362 | |
| 363 | /** |
| 364 | * Returns promise with the data. |
no test coverage detected