On 12/09/19 8:25 pm, fansari wrote: > In my scenrio (squid 3.5.23) I have several clients which download content. > > Now I want to achieve two things: if one client has already downloaded the > content the second client requesting the same content should take it from > the squid cache. > > But: when this content resource on the internet is changing the squid should > not give a HIT but a MISS and refresh the content the next time a client is > requesting it. No. HTTP specifies that the cache should update its copy of the content, and deliver the new result. This is *not* a MISS. It is a REFRESH in the logs, or a "Near-HIT" in the traffic statistics report. > > It is not clear to me how to achieve this behaviour. You do not have to do anything. For content which this behaviour is possible, Squid does it by default. > > The application (server on internet) sends headers like this: > > cache-control: public, max-age=0 'public' - this object is allowed to be stored in caches. 'max-age=0' - the cache is required to contact the server for updates before delivering this object to any clients. > last-modified: Thu, 12 Sep 2019 07:30:56 GMT > etag: W/"6699e3-16d2461dba1" > > So far I could only achieve HITs using refresh_pattern with min value > 0. > > refresh_pattern . 30 20% 1440 override-expire > refresh_pattern provides default values for Squid to use in its caching algorithm if the server does not provide them. The headers you show above contain clear and precise cache-control instructions. So refresh_pattern is not normally relevant to that object. By adding the override-expires option you are *forcing* the object to be cached for no less than 30 minutes and no more than 1 week... > But also this configuration is not exactly what I want. > > Now even if the content of a resource on the internet is changing I get HITs > for 30 min. > Not just that resource. By using the '.' pattern you are forcing this 30min HIT on *every* object any client fetches through this cache. It is best to be a specific as you can in the pattern field. Especially when using the ignore-* and override-* options. To reduce nasty side effects. PS. The server is delivering cache controls, what makes you think the server developer and admin are wrong about their own content and systems? Amos _______________________________________________ squid-users mailing list squid-users@xxxxxxxxxxxxxxxxxxxxx http://lists.squid-cache.org/listinfo/squid-users