Mod_pagespeed delete cache?

36,897

Solution 1

Google's PageSpeed docs on Legacy Flushing Of Entire Cache suggests this:

sudo touch /var/cache/mod_pagespeed/cache.flush

Solution 2

From: https://developers.google.com/speed/docs/mod_pagespeed/faq#ignores-changes

There are two distinct cache-times at play when you use mod_pagespeed:

The origin TTL which mod_pagespeed uses to refresh its internal server-side cache.

The TTL with which mod_pagespeed serves rewritten resources to browsers. When mod_pagespeed first reads your reousrce file, it uses the origin TTL to figure out how often to re-examine the origin CSS file. Assume your origin TTL is 1 day. Once mod_pagespeed has that file in cache, it will not go back & re-check that file for a day. Changing the TTL after mod_pagespeed has put the resource in its cache will not help because mod_pagespeed is not going to reload the resource until the one in its cache expires, or you clear its cache.

We recommend an origin TTL of 10 minutes, which provides reasonable responsiveness when you update a file. If you try to make it much smaller, then your server will need to refresh it more frequently. This adds server load and reduces optimization.

To see changes to your files more quickly while developing, flush the cache on your server(s).

If your environment allows you to enable ModPagespeedLoadFromFile, you can get the best of both worlds because mod_pagespeed can eliminate its internal server-side cache.

Solution 3

Flushing the cache of a specific page in Pagespeed requires that the server support cache purging. In Apache, this means ModPagespeedEnableCachePurge on in the site's configuration. In Nginx, you'll need pagespeed EnableCachePurge on; instead. This setting allows you to send a specially-crafted HTTP request to force-purge a specific page in Pagespeed. For example with cURL:

curl 'http://example.com/pagespeed_admin/cache?purge=path/file.ext'

There is also another method for purging single pages in the cache (curl --request PURGE 'http://www.example.com/path/file.ext'), however this requires an extra, optional config option in your site's config file (ModPagespeedPurgeMethod PURGE for Apache and pagespeed PurgeMethod PURGE; for Nginx).

For more information, please refer to the documentation describing this process for more detail.

Solution 4

sudo touch /var/cache/mod_pagespeed/cache.flush

Load the page again. You should see the changes

Solution 5

On bitnami AWS server (lightsail) use this commands:

sudo touch /opt/bitnami/apache2/var/cache/mod_pagespeed/cache.flush

Restart Apache:

sudo /opt/bitnami/ctlscript.sh restart apache

Here is the help page.

Share:
36,897
Szed
Author by

Szed

Updated on July 05, 2022

Comments

  • Szed
    Szed almost 2 years

    We have a server (OVH - France), with Apache and mod_pagespeed. On this server, I have an installation of WordPress.

    I made a change in a Javascript file in my theme, but pagespeed don't understand there is a new file, and keeps loading the original javascript file. js/ui.js.pagespeed********

    I made the change two weeks ago, rebooted the server this morning, and it is still loading the original Javascript file.

    How can I delete the pagespeed cache?

    On my server, in /var/mod_pagespeedcache/http,3A/,2Fwww.myURL.fr/wp-content/themes/mytheme/js, I see the ui.js.pagespeed.jm.************.js.

    Could I just delete this file?