* @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 */
| 245 | * @return true - hit fresh, false - miss/stale/skipped or error |
| 246 | */ |
| 247 | static bool |
| 248 | foundFresh(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) |
no test coverage detected