Search squid archive

Re: [squid-users] Clearing the Squid cache or disabling caching during certain periods

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 7 Feb 2005, jennyw wrote:

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).

The best approach to this is to make the web server set proper cache-control and/or Expires headers. Will make your and your users life much better.


If this is not done you will have to battle with getting the maintenance pages out of the users proxy and/or browser caches as well, not only your accelerator cache.


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

You should either use the init script for both actions, or not at all.
Also, "squid -k shutdown" will take a while to complete during which time you should monitor the pid file.


If you do not care about existing users at the time then use "squid -k kill" which terminates Squid immediately with no mercy.

Also, does anyone have suggestions on causing a certain set of URLs to not be cached during a certain time of night?

See the no_cache directive, combined with the proper acl types to match the requests you do not want to be cached.


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.

No need to switch between two configs for this. Squid is fully aware of time allowing the same configuration to be used during both periods.


Regards
Henrik

[Index of Archives]     [Linux Audio Users]     [Samba]     [Big List of Linux Books]     [Linux USB]     [Yosemite News]

  Powered by Linux