* @brief Checks if we are still supposed to schedule a background fetch based on whether the object is in the cache. * It is 'fetchable' only if not a fresh hit. * * @param txnp HTTP transaction structure * @param data transaction data * @return true if fetchable and false if not. */
| 441 | * @return true if fetchable and false if not. |
| 442 | */ |
| 443 | static bool |
| 444 | isFetchable(TSHttpTxn txnp, PrefetchTxnData *data) |
| 445 | { |
| 446 | bool fetchable = false; |
| 447 | BgFetchState *state = data->_inst->_state; |
| 448 | if (!foundFresh(txnp)) { |
| 449 | /* Schedule fetch only if not in cache */ |
| 450 | PrefetchDebug("object to be fetched"); |
| 451 | fetchable = true; |
| 452 | } else { |
| 453 | PrefetchDebug("object already in cache or to be skipped"); |
| 454 | state->incrementMetric(FETCH_ALREADY_CACHED); |
| 455 | state->incrementMetric(FETCH_TOTAL); |
| 456 | } |
| 457 | return fetchable; |
| 458 | } |
| 459 | |
| 460 | /** |
| 461 | * @brief Find out if the current response to trigger a background prefetch. |
no test coverage detected