MCPcopy Create free account
hub / github.com/apache/trafficserver / isFetchable

Function isFetchable

plugins/prefetch/plugin.cc:443–458  ·  view source on GitHub ↗

* @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. */

Source from the content-addressed store, hash-verified

441 * @return true if fetchable and false if not.
442 */
443static bool
444isFetchable(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.

Callers 1

contHandleFetchFunction · 0.85

Calls 2

foundFreshFunction · 0.85
incrementMetricMethod · 0.45

Tested by

no test coverage detected