Clear mod pagespeed cache

From Brian Nelson Ramblings
Revision as of 13:43, 6 August 2014 by Brian (Talk | contribs) (Created page with "==clear mod_pagespeed cache== The Apache module mod_pagespeed can be used to automatically make web pages faster without effort. It promises a 50% speed boost. I’ve been us...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

clear mod_pagespeed cache

The Apache module mod_pagespeed can be used to automatically make web pages faster without effort. It promises a 50% speed boost. I’ve been using for some time and can confirm that there is a definitive speed increase.

But there is a big problem when I update the styling of my blog. When I change the theme css file, I do not see the changes. In the beginning I thought it was caused by the caching plugin I use. But after deactivating the plugin, the problem persisted. Using Ctrl-F5 did not help either. I also opened the CSS in the browser and pressed Ctrl-F5. Nothing worked.

Finally, I understood that mod_pagespeed was responsible for it. So I just needed to clear its cache. Unfortunately it seems to be only possible from the command line. So first open a shell. Then you need to find out where the cache is. It is configured in pagespeed.conf. So either open the file and search for ModPagespeedFileCachePath or execute the following:

Find your mod_pagespeed cache location

grep -i "^ *modpagespeedfilecachepath" /etc/httpd/conf.d/pagespeed.conf

Resulting in

ModPagespeedFileCachePath            "/var/cache/mod_pagespeed/"

Create the mod_pagespeed flush cache file

Now you will want to create a file in that directory called cache.flush

touch /var/cache/mod_pagespeed/cache.flush

You can leave this file there, as it goes off the time stamp to figure out which cache files need refreshed.