Small optimization to the external ACL caching behaviour. With bigger than itself effects.
Admin configure ttl=0 and/or negative_ttl=0 to prevent Squid storing the ACL lookup results. The problem is that results still get cached and re-used for the grace= period. IMO this grace period should only occur for results which are allowed to be re-used. The attached patch changes the external ACL caching slightly to actually not store the results when their matching TTL is zero. Side effects of this (on systems with ttl <= 0 or negative_ttl <= 0) are: less memory usage expected non-caching works FAST category ACL tests not able to be used on non-cached results less processing cycles on result hash insertion * traded for potential cycles on hash lookups Amos
=== modified file 'src/external_acl.cc' --- src/external_acl.cc 2010-12-14 14:01:14 +0000 +++ src/external_acl.cc 2011-01-24 23:19:34 +0000 @@ -1113,6 +1113,11 @@ static external_acl_entry * external_acl_cache_add(external_acl * def, const char *key, ExternalACLEntryData const & data) { + // do not bother caching this result if TTL is going to expire it immediately + if ((def->ttl <= 0 && data.result == 1) || (def->negative_ttl <= 0 && data.result != 1)) { + return NULL; + } + ExternalACLEntry *entry = static_cast<ExternalACLEntry *>(hash_lookup(def->cache, key)); debugs(82, 2, "external_acl_cache_add: Adding '" << key << "' = " << data.result);