[squid-users] Cache everything for 15 minutes - nothing more or less (offline_mode + refresh_pattern?)
Amos Jeffries
squid3 at treenet.co.nz
Tue Oct 27 12:39:45 UTC 2015
On 27/10/2015 1:57 p.m., Kris Linquist wrote:
> I’ve got a bunch of services connecting to third party APIs. Many of
> these APIs register hits even if squid reaches out to the service to
> check the HTTP headers (I verified that hits with the log
> TCP_REFRESH_UNMODIFIED/200 are being counted against me with the
> third party service).
Refresh is more efficient than either HIT or MISS. The origin *has* been
contacted, but it said the cached content was still good to be used.
This is HTTP/1.1, not HTTP/1.0.
Squid is a cache, not an archive or buffer.
>
> offline_mode on seems to never return fresh results, no matter what
> my refresh_pattern is.
That is pretty much what offline_mode is designed to do. Cache
everything no matter how stale and serve it while the origin has
possibly gone offline/down for maintenance.
> I want fresh results every 15 minutes,
Sqiud is designed to output fresh results. Full stop.
Serving non-fresh results is dangerous unless the origin has explicitly
stated that they may be served.
> otherwise return HIT from memory and don’t reach out. Is this
> possible? Perhaps I just haven’t found the right combination of
> refresh_pattern options.
>
That is not how HTTP works.
Caching has a fixed algorithm for freshness built into the
specifications. The origin server is in control of the parameters for
that. It states how long the content is fresh for and what the proxy is
permitted to do with it. Only when it leaves a parameter unstated can
refresh_pattern be used to supply the default value you want.
As I mentioend to Yuri in another thread recently, Ths is very much akin
to liceneing of copyright materials, where the origin is the content
owner and asigning rights to redistributors (proxies). Taking on other
rights that have been explicitly denied is not a good situation.
Amos
More information about the squid-users
mailing list