Friday, July 1, 2011

How to Clear Cache on Squid 3 - Debian 6.0

There are 4 steps in clearing the cache of squid3.

1. Stop squid3.
$/etc/init.d/squid3 stop

2. Delete the cache directory.
$rm -Rf /var/spool/squid3/*

3. Create swap Directories.
$squid3 -z

4. Start squid3.
/etc/init.d/squid3 start

To make it easier, you can just do it in one shot.
Here's a script that I made to do that.

#clear cache squid3 by lui 06-01-2011

/etc/init.d/squid3 stop;
sleep 1;
rm -Rf /var/spool/squid3/*;
sleep 1;
squid3 -z;
sleep 1;
/etc/init.d/squid3 start;

After clearing the cache, you can verify it by using "squidclient" to check squid cache storage.
1. Install squidclient.
$apt-get install squidclient

2. Check the cache storage capacity.
$squidclient mgr:storedir

Look for this line:
Current Capacity: 0% used, 100% free

No comments:

Post a Comment