Mod_pagespeed delete cache?
Asked Answered
D

6

13

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?

Devaluate answered 26/10, 2012 at 7:53 Comment(2)
For future questions, I'd suggest you contact us directly at groups.google.com/forum/?fromgroups#!forum/… where you are more likely to get a quick response.Slide
Duplicate of serverfault question : serverfault.com/questions/435412/…Facetious
M
16

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

sudo touch /var/cache/mod_pagespeed/cache.flush
Mensural answered 6/4, 2016 at 18:21 Comment(4)
Just a heads up - I have tried this multiple times to no avail. I have also seen other responses saying that it didn't work.Taste
works for me. maybe due to which OS and pagespeed version. mine is Debian 7.10 with X-Mod-Pagespeed "1.9.32.14-0"Robustious
If doesn't work, try ctrl+f5 in browser to reload page with cache clear.Goggleeyed
This worked for me on Debian 10, Apache/2.4.38, mod-pagespeed-stable 1.13.35.2-r0Estellestella
S
7

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.

Slide answered 1/11, 2012 at 17:7 Comment(0)
S
4

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.

Smoothie answered 28/1, 2015 at 22:35 Comment(0)
P
3
sudo touch /var/cache/mod_pagespeed/cache.flush

Load the page again. You should see the changes

Pegboard answered 20/11, 2016 at 1:37 Comment(0)
B
3

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.

Balenciaga answered 10/1, 2018 at 18:22 Comment(0)
F
0

Flush cache nginx pagespeed

sudo touch /var/cache/ngx_pagespeed/cache.flush
Feudal answered 29/7, 2021 at 17:39 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.