Re: [squid-users] Re: Problems checking if an object is in cache or not

From: Amos Jeffries <squid3_at_treenet.co.nz>
Date: Thu, 05 Dec 2013 11:30:14 +1300

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?

Amos
Received on Wed Dec 04 2013 - 22:30:18 MST

This archive was generated by hypermail 2.2.0 : Thu Dec 05 2013 - 12:00:04 MST