RE: [squid-users] Clearing the Squid cache or disabling caching d uring certain periods

From: Chris Robertson <crobertson@dont-contact.us>
Date: Mon, 7 Feb 2005 14:40:54 -0900

> -----Original Message-----
> From: jennyw [mailto:jennyw@dangerousideas.com]
> Sent: Monday, February 07, 2005 1:32 PM
> To: squid-users@squid-cache.org
> Subject: [squid-users] Clearing the Squid cache or disabling caching
> during certain periods
>
>
> We're using Squid as a Web accelerator and need to clear the cache every
> morning (the store goes into maintenance mode at 4 a.m. and all pages
> have a message saying so; we don't want those pages cached).
>
> Based on FAQ 7.3 (http://www.squid-cache.org/Doc/FAQ/FAQ-7.html#ss7.3),
> I wrote this script to clear my Squid cache:
>
> /usr/local/squid2/sbin/squid -k shutdown
> echo "" > /cache/swap.state
> /etc/init.d/squid start
>
> This works but it sometimes has problems. Most of the times I've run it,
> it works great. However, sometimes when I run it, it says there are no
> running instances of Squid, and then subsequently Squid doesn't start
> up. Any ideas on why this might be? I have been running the script a
> few times in a row, which might be part of the problem ... could it just
> be that I'm not giving it enough time before running it again, or could
> something else be at work?
>
> Also, does anyone have suggestions on causing a certain set of URLs to
> not be cached during a certain time of night? My idea right now is to
> have two squid.conf files -- one that includes the URLs affected by
> maintenance mode and one that doesn't include them -- and setting up
> cron jobs to switch between config files before and after the
> maintenance period.
>
> Thanks!
>
> Jen
>

First a disclaimer. I've never tried something like this, so I have no idea
if it would work.

Anyway, by combining the "time" acl and the "no_cache" directive, you should
be able to specify times when URLs are not cached.

Something like:

acl maint_time time 04:00-05:00
acl maint_pages dstdomain .my.server
no_cache deny maint_time maint_pages

should prevent any pages served from the domain of my.server (and any
subdomains) from being cached between 4am and 5am, but will allow them to be
cached any other time of the day. I think... Again, I haven't tried this.

Chris
Received on Mon Feb 07 2005 - 16:42:25 MST

This archive was generated by hypermail pre-2.1.9 : Tue Mar 01 2005 - 12:00:01 MST