DOC_END
NAME: negative_ttl
+IFDEF: HTTP_VIOLATIONS
COMMENT: time-units
TYPE: time_t
LOC: Config.negativeTtl
-DEFAULT: 5 minutes
+DEFAULT: 0 seconds
DOC_START
- Time-to-Live (TTL) for failed requests. Certain types of
- failures (such as "connection refused" and "404 Not Found") are
- negatively-cached for a configurable amount of time. The
- default is 5 minutes. Note that this is different from
- negative caching of DNS lookups.
+ Set the Default Time-to-Live (TTL) for failed requests.
+ Certain types of failures (such as "connection refused" and
+ "404 Not Found") are able to be negatively-cached for a short time.
+ Modern web servers should provide Expires: header, however if they
+ do not this can provide a minimum TTL.
+ The default is not to cache errors with unknown expiry details.
+
+ Note that this is different from negative caching of DNS lookups.
WARNING: Doing this VIOLATES the HTTP standard. Enabling
this feature could make you liable for problems which it
case -1:
+#if HTTP_VIOLATIONS
if (Config.negativeTtl > 0)
entry->cacheNegatively();
else
+#endif
entry->makePrivate();
break;
assert(mem_obj != NULL);
debugs(20, 6, "storeAbort: " << getMD5Text());
- lock()
-
- ; /* lock while aborting */
+ lock(); /* lock while aborting */
negativeCache();
releaseRequest();
return 1;
}
+/**
+ * Set object for negative caching.
+ * Preserves any expiry information given by the server.
+ * In absence of proper expiry info it will set to expire immediately,
+ * or with HTTP-violations enabled the configured negative-TTL is observed
+ */
void
StoreEntry::negativeCache()
{
- expires = squid_curtime + Config.negativeTtl;
+ if(expires == 0)
+#if HTTP_VIOLATIONS
+ expires = squid_curtime + Config.negativeTtl;
+#else
+ expires = squid_curtime;
+#endif
EBIT_SET(flags, ENTRY_NEGCACHED);
}
int64_t readAheadGap;
RemovalPolicySettings *replPolicy;
RemovalPolicySettings *memPolicy;
+#if HTTP_VIOLATIONS
time_t negativeTtl;
+#endif
time_t negativeDnsTtl;
time_t positiveDnsTtl;
time_t shutdownLifetime;