• Resolved Ari123

    (@ucdguy)


    Hi!

    Thank you for a great plugin!

    I’m a little bit confused as to how and when pages are purged, the TTL of pages etc. with this plugin.

    My page cache is set to “Disk:Enhanced”. I have browser cache turned off and “Set expires header” for HTML & XML turned off. I’ve also unticked all of these (temporarily).

    However, the cache (at least on the homepage) seems to be purging every hour or two (unsure of the exact time) even if I’m not on my computer. In particular, every time I wake up and check my website, the cache on my homepage has been purged.

    I don’t have any other cache plugins installed nor do I have plugins being automatically updated etc. Just for testing, I disabled this plugin and enabled the Litespeed plugin where I can see that the TTL is a week by default. And indeed, when I wake up with this plugin installed instead, my pages are still cached.

    I assume that I’m missing some setting? How can I ensure that my pages remain cached (for at least a week for example) unless I manually purge them before then myself?

    (I cannot provide a link as my page is not live.)

    Thanks for your help!

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @ucdguy

    Thank you for reaching out and I am happy to assist you with this.
    The BC TTL option in W3 Total Cache is simply stating how long before the user’s browser will fetch new cached pages if available on the server.
    In W3 Total Cache, you cannot schedule the purge of the cache. This being said, once the Page is cached, it will remain in the cache until the cache is purged.
    If content like an updated page, blog, or a new article is posted, depending on the settings in Performance>Page Cache>Purge policy, the cache will be purged. Hence, the new content is available for visitors.

    the cache (at least on the homepage) seems to be purging every hour or two (unsure of the exact time) even if I’m not on my computer. In particular, whenever I wake up and check my website, the cache on my homepage has been purged.

    Can you please elaborate on this and let me know how you can see that the cache has been purged every hour?

    THanks!

    Thread Starter Ari123

    (@ucdguy)

    Hi,

    Thank you for your quick response!

    Can you please elaborate on this and let me know how you can see that the cache has been purged every hour?

    The first contentful paint on my homepage is about 5 seconds when the page is not cached (i.e. if I either disable the plugin or purge the cache manually and then reload) and about 300 ms when it is cached, so it’s easy to spot.

    When I purge my cache and reload my homepage, it takes about 5 seconds before anything shows. If I then reload it again, things start showing instantly (in 300 ms) as the page is now cached. If I reload the page a few minutes later, it’s still instant (300 ms). However, if I wait an hour or two instead, or go to bed and wake up, it again takes 5 seconds the first time and 300 ms each time after that, therefore suggesting that the homepage has been purged in between for some reason.

    This doesn’t happen with the Litespeed cache plugin.

    Is there something I’m missing?

    Thanks again!

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @ucdguy

    It would be awesome if you could share your website URL so I can check this also because it sounds amazing, maybe reaching out directly via the support channel?
    How are you checking the first contentful paint? And also since the pages are also cached in the Browser, have you tried enabling the Set expires header and cache control header in the Browser Cache section?
    If the BC is disabled, every time you close and re-open the browser, the browser needs to go and fetch the new set of pages even when those are cached.
    You can check the timestamp in the /cache/folder for any cached page.
    Now if you have any suspicions that the cache is being purged, you can check the purge logs that are available in the Performance>General settings>Debug section and select Page Cache.

    Thanks!

    Thread Starter Ari123

    (@ucdguy)

    How are you checking the first contentful paint?

    Using Lighthouse, but it’s easy to spot directly since there’s such a big difference in loading time.

    And also since the pages are also cached in the Browser, have you tried enabling the Set expires header and cache control header in the Browser Cache section?
    If the BC is disabled, every time you close and re-open the browser, the browser needs to go and fetch the new set of pages even when those are cached.

    Yes browser cache is disabled, and I still have the same issue if I leave my browser open for an hour or two.

    You can check the timestamp in the /cache/folder for any cached page.

    So I ran a little test.

    I purged all cache at 3pm and refreshed my homepage. The timestamps were then as shown here.

    I then did nothing for 15 minutes. Then I refreshed my homepage and it refreshed instantly. My timestamps afterwards were than as shown here.

    I then did nothing until 5pm. Just before refreshing the homepage, I decided to check my timestamps again. They were as shown here. I then refreshed my homepage. It instead took five seconds to reload (the same time it would take if I disabled this plugin). The timestamps were then as shown here.

    (I refreshed all of the pages above in incognito mode so that I was a visitor rather than a logged-in user.)

    A few questions about the above results:

    1) When I purged all cache at 3pm and then refreshed my homepage, why did the timestamp on the “page-enhanced folder” not update? I have page caching enabled and “Don’t cache front page” disabled, as shown here. Is it because as there was no changes to any of my website, the plugin knew this and therefore didn’t see any reason to change the files in the folder, even though I asked it to purge the files in the folder?

    2) My db and object cache folder seem to be updating in the background, even if I’m not on my computer and even though my site is not live and therefore has no visitors. Is that expected behaviour?

    3) My homepage reloaded instantly at 3:15pm but reloaded slowly at 5pm. The only difference appears to be that the db folder updated for the latter and not the former. So the reason for my longer load times if I wait an hour or two is my database cache appears to be getting purged in between, is that right? Here are my settings for my database cache. If I don’t want to have these 5 second delays for at least e.g. a week, do I have change one (or both) of these numbers to a week?

    Now if you have any suspicions that the cache is being purged, you can check the purge logs that are available in the Performance>General settings>Debug section and select Page Cache.

    I was planning on including the debug info at each timestamp and then completely forgot to do it! I’ll post that info in a few hours.

    Thanks again!

    • This reply was modified 2 years, 7 months ago by Ari123.
    Thread Starter Ari123

    (@ucdguy)

    So, I purged all of my cache at 6pm and 6:15pm. My debug info on both occasions (with my homepage refreshing instantly) was as follows:

    Object Caching 78/503 objects using disk
    
    Object Cache debug info:
    Caching:            enabled
    Total calls:        503
    Cache hits:         78
    Total time:         0.0603
    Page Caching using disk: enhanced 
    
    Page cache debug info:
    Engine:             disk: enhanced
    Cache key:          mywebsite.com/_index_slash_ssl.html
    Creation Time:      1658941247.000s
    Header info:
    X-Powered-By:       PHP/7.3.33
    Content-Type:       text/html; charset=UTF-8
    Set-Cookie:         pmpro_visit=1; path=/; secure; HttpOnly
    Link:               <https://mywebsite.com/wp-json/>; rel="https://api.w.org/"
    Link:               <https://mywebsite.com/wp-json/wp/v2/pages/274>; rel="alternate"; type="application/json"
    Link:               <https://mywebsite.com/>; rel=shortlink
    
    Minified using disk
    
    Minify debug info:
    Theme:              c128e
    Template:           index
    
    Database Caching using disk (Request-wide modification query)
    
    Db cache debug info:
    Total queries:      232
    Cached queries:     0
    Total query time:   0.3312
    
    Served from: mywebsite.com @ 2022-07-27 18:00:12 by W3 Total Cache

    I then did nothing until I refreshed the homepage again shortly after 7pm and it instead took 5 seconds to refresh. My debug info was as follows:

    Object Caching 1/670 objects using disk
    
    Object Cache debug info:
    Caching:            enabled
    Total calls:        670
    Cache hits:         1
    Total time:         0.1403
    Page Caching using disk: enhanced 
    
    Page cache debug info:
    Engine:             disk: enhanced
    Cache key:          mywebsite.com/_index_slash_ssl.html
    Creation Time:      1658945052.000s
    Header info:
    X-Powered-By:       PHP/7.3.33
    Content-Type:       text/html; charset=UTF-8
    Set-Cookie:         pmpro_visit=1; path=/; secure; HttpOnly
    Link:               <https://mywebsite.com/wp-json/>; rel="https://api.w.org/"
    Link:               <https://mywebsite.com/wp-json/wp/v2/pages/274>; rel="alternate"; type="application/json"
    Link:               <https://mywebsite.com/>; rel=shortlink
    
    Minified using disk
    
    Minify debug info:
    Theme:              c128e
    Template:           index
    
    Database Caching using disk (Request-wide modification query)
    
    Db cache debug info:
    Total queries:      367
    Cached queries:     0
    Total query time:   0.3841
    
    Served from: mywebsite.com @ 2022-07-27 19:04:12 by W3 Total Cache

    If you have any insight as to what is causing my issue I would greatly appreciate it, thanks!

    • This reply was modified 2 years, 7 months ago by Ari123.
    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @ucdguy

    YOu should go to wp-content/cache/yourwebsite.com/ and check the cached pages timestamp.
    Also, Please make sure to enable HTML&XML expires header and cache control header, and for that matter, you can set it to one week.
    thanks!

    Thread Starter Ari123

    (@ucdguy)

    YOu should go to wp-content/cache/yourwebsite.com/ and check the cached pages timestamp.

    Did I not do that above? Did you miss that I wrote two posts? ??

    Let me know if the post that you missed helps, thanks!

    Also, Please make sure to enable HTML&XML expires header and cache control header, and for that matter, you can set it to one week.

    Well I don’t actually want it to expire at all. I was just stating one week as it would be preferred to the current one or two hours that I seem to have. ??

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @ucdguy

    Thank you for your feedback.
    Sorry I was referring to wp-content/cache/yourwebsite.com/page_enhanced/ folder. There you can see all the pages and the timestamp.
    Once again, if the page is not cached in the browser, every time you close and open a browser, the page will need to be fetched again, cached or not.
    This is why you should enable Expires header and cache control header for the HTML&XML
    Thanks!

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Cache is purging by itself?’ is closed to new replies.