On 2013-12-05 06:07, RW wrote: > On Wed, 4 Dec 2013 15:45:42 +0000 > Donoso Gabilondo, Daniel wrote: > > >> I saw in internet that I should use squidclient with -t option to >> check if an object is cached. Why need I enable TRACE on server to >> check if a object is cached in the client (Squid)? > > I think it would be -t 0 to get the trace from squid, but I don't see > how that would tell you whether the object is cached. > > >> I need to ask to >> squid directly if an object is cached or not without server >> intervention. How can I do it? > > The headers in a GET response will tell you if it's served from cache > i.e. just leave out the -t. >Yes. Also add the header: > Cache-Control:only-if-cached >That will make Squid produce an error instead of fetching a new copy from the server. It will not prevent revalidation the cache needs to do in order to be able to respond about certain types of cached object. >The big question though is why you need to do this at all? what is the use-case this fetch/test is part of? Some customers have very slow networks, and they have some big resources (videos). Then, at night, when they don't use the network for anything else, our server application informs to client application that it must download the resources for the next day. The goal is to guarantee that resources are cached in client before they must be sown, and prevent playback cuts due to network delay. Our client application must check if each resource is cached or not and inform to server application, but not only after download them. The server application can send when a user wants a command to the client application to check if a resource is cached or not, only to check. The resources only are downloaded at night. How can I do it? I tried to use squidclient with the HEAD command but it always answers "MISS" the first time when the objects are cached. The second time always answers "TCP_HIT" but with resources that are not cached too. >Amos