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

Function foundFresh

plugins/prefetch/plugin.cc:247–263  ·  view source on GitHub ↗

* @brief Find out if the object was found fresh in cache. * * This function finely controls if the pre-fetch should be scheduled or not. * @param txnp HTTP transaction structure * @return true - hit fresh, false - miss/stale/skipped or error */

Source from the content-addressed store, hash-verified

245 * @return true - hit fresh, false - miss/stale/skipped or error
246 */
247static bool
248foundFresh(TSHttpTxn txnp)
249{
250 bool fresh = false;
251 int lookupStatus;
252 if (TS_SUCCESS == TSHttpTxnCacheLookupStatusGet(txnp, &lookupStatus)) {
253 PrefetchDebug("lookup status: %s", getCacheLookupResultName((TSCacheLookupResult)lookupStatus));
254 if (TS_CACHE_LOOKUP_HIT_FRESH == lookupStatus) {
255 fresh = true;
256 }
257 } else {
258 /* Failed to get the lookup status, likely a previous plugin already prepared the client response w/o a cache lookup,
259 * we don't really know if the cache has a fresh object, so just don't trigger pre-fetch */
260 PrefetchDebug("failed to check cache-ability");
261 }
262 return fresh;
263}
264
265/**
266 * @brief Check if the response from origin for N-th object is success (200 and 206)

Callers 2

isFetchableFunction · 0.85
respToTriggerPrefetchFunction · 0.85

Calls 2

getCacheLookupResultNameFunction · 0.70

Tested by

no test coverage detected