From 70b4610310913c31b8618f225013fa98eb62ecea Mon Sep 17 00:00:00 2001 From: Brian Neradt Date: Wed, 19 Jan 2022 21:20:00 +0000 Subject: [PATCH] Commenting TSHttpTxnCacheLookupStatusGet need_to_revalidate Adding a comment explaining why we return a MISS when need_to_revalidate fails as it would be natural to consider returning STALE in such circumstances. --- src/traffic_server/InkAPI.cc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/traffic_server/InkAPI.cc b/src/traffic_server/InkAPI.cc index 414affcc67a..f51c2a68d25 100644 --- a/src/traffic_server/InkAPI.cc +++ b/src/traffic_server/InkAPI.cc @@ -5430,6 +5430,15 @@ TSHttpTxnCacheLookupStatusGet(TSHttpTxn txnp, int *lookup_status) case HttpTransact::CACHE_LOOKUP_HIT_WARNING: case HttpTransact::CACHE_LOOKUP_HIT_FRESH: if (HttpTransact::need_to_revalidate(&sm->t_state)) { + // Note that in this case the object was determined to be fresh but there + // was a problem with the cached object for this request per + // need_to_revalidate(). need_to_revalidate() checks for issues such as + // the need to authenticate with the origin or the incoming request + // method doesn't equal the method of the request for the cached + // response. Issues like this are more accurately described as a MISS + // rather than STALE because they are not due to freshness (timing) + // issues but rather to characteristics that make the cached object + // inappropriate as a response to this request. *lookup_status = TS_CACHE_LOOKUP_MISS; } else { *lookup_status = TS_CACHE_LOOKUP_HIT_FRESH;