iRSSの日記

はてなダイアリーiRSSの日記の続き

squidでエラーをキャッシュさせない方法

negative_ttl 0 minutes

とすれば、よさそう

Tag Name negative_ttl
Usage negative_ttl time-units
Description
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. Note that, this is different from negative caching of DNS lookups.

Default
The default is 5 minutes.

negative_ttl 5 minutes

TCP_NEGATIVE_HIT
? ? ? ? When a request to an origin server results in an HTTP error, Squid
may cache the response anyway. Repeated requests for these resources, within
a short amount of time, result in negative hits. The negative_ttl directive
controls the amount of time these errors may be cached. Also note that
errors are cached only in memory and never written to disk. The following
HTTP status codes may be negatively cached, subject to additional
constraints: 204, 305, 400, 403, 404, 405, 414, 500, 501, 502, 503, 504.

In Squid 2.6 configuration manual, it says, we can use negative_ttl to
control Time-to-Live (TTL) for failed requests.