]> git.ipfire.org Git - thirdparty/squid.git/commit
Bug 5030: Negative responses are never cached (#566)
authorDrDaveD <2129743+DrDaveD@users.noreply.github.com>
Wed, 18 Mar 2020 17:34:45 +0000 (17:34 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Thu, 19 Mar 2020 10:46:34 +0000 (10:46 +0000)
commit91870bfbba49e4d707e3e4001137d08fbff746cf
tree2834f36588c8cbf061bddcee85a85b45d2551fcf
parentf66e113ee7f6dbbc767c853752ea5585c9e7cca8
Bug 5030: Negative responses are never cached (#566)

Negative caching was blocked by checkCachable().

Since 3e98df2, Squid cached ENTRY_NEGCACHED entries in memory cache
only. Back then, storeCheckSwapable() prevented what later became
ENTRY_NEGCACHED entries from going to disk. The design was obscured by
8350fe9 that renamed storeCheckSwapable() to storeCheckCachable().

Commit 97754f5 violated that (obscured) design by adding a
checkCachable() call to StoreEntry::memoryCachable(), effectively
blocking ENTRY_NEGCACHED entries from the memory cache as well. That
call should have been added, but checkCachable() should not have denied
caching rights to ENTRY_NEGCACHED -- the corresponding check should have
been moved into StoreEntry::mayStartSwapOut().

By removing ENTRY_NEGCACHED from checkCachable(), we now allow
ENTRY_NEGCACHED entries into both memory and disk caches, subject to all
the other checks. We allow ENTRY_NEGCACHED to be cached on disk because
negative responses are fundamentally no different than positive ones:
HTTP allows caching of 4xx and 5xx responses expiring in the future.
Hopefully, the increased disk cache traffic will not be a problem.
src/store.cc