• Resolved scrhorton

    (@scrhorton)


    When using enhanced disk page caching, I have read that the page cache expiry time is determined by the “Expires header lifetime” field in the “HTML” section on Browser Cache Settings tab (default value 1 hour). I have also read that files in the page cache are marked as expired by appending “_old” to the filename.

    My question: Which process is responsible for marking page cache files as expired, how often does it run and is it influenced in any way by the settings for page cache priming/preloading and/or page cache garbage collection interval?

    Reason for questions: With “Expires header lifetime” set to the default value of 1 hour, I am seeing plenty of cached pages that are more than 1 hour old but not yet marked as expired (i.e. filename does not have the “_old” suffix).

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

    (@vmarko)

    Hello @scrhorton

    Thank you for your inquiry and I am happy to assist you with this.
    The Set expires header value in HTML&XML indicates how long will the page stay cached in the Browser.
    The Page is cached with the Page cache and served to the visitors. It’s also cached in the Browser in the specified time frame in this case 1 hour. So after one-hour browser will fetch a fresh page if available.
    When it comes to Page Cache, when the page is cached, it stays cached until the cache is purged. After the cache is purged the old pages get _old suffix and a new set of pages are being cached. The _old pages are categorized as garbage, and this is where the Garbage collection interval in Performance>Page Cache comes to work.
    When it comes to Cache Priming, once the entire website is primed (cache preload) the cache priming will start from the beginning, and again once new pages are cached, the old pages get _old suffix and being handled by the Garbage collection interval – deleted from the server after specified time value.
    I hope this helps!
    Thanks!

    Thread Starter scrhorton

    (@scrhorton)

    Hello @vmarko,

    I appreciate your reply. May I ask a couple more questions to refine my understanding?

    You wrote: “When it comes to Page Cache, when the page is cached, it stays cached until the cache is purged.”

    When exactly is the page cache purged and over what period? If the “Expires header lifetime” setting is set to 1 hour, does an automatic purge happen in one big operation every hour or is there some background process that spreads the purge over a longer period. FYI, I am seeing files in the page cache that are older than 1 hour but not yet marked “_old”.

    You wrote: “The _old pages are categorized as garbage, and this is where the Garbage collection interval in Performance>Page Cache comes to work.”

    Again, if the garbage collection interval is set to the default value of 1 hour, does this mean that there is a big operation every hour that goes through the whole page cache (potentially thousands of pages) looking for “_old” files or is this somehow spread out over time?

    Thanks in advance.

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @scrhorton

    Thank you for your questions and I am happy to clarify.
    The page is purged if you manually purge the cache using the Purge all cache button or empty page cache (depending on the W3tc page you are on). The page cache is also purged when the posts are updated, or new articles added. Again expires header is a browser cache directive.
    If the Garbage collection interval is set to one hour then every hour some _old files are deleted defending on a logic.
    Thanks!

    Thread Starter scrhorton

    (@scrhorton)

    Hello @vmarko,

    You say the cache is purged when the user makes any of a number of manual actions (‘purge all cache’ button, ’empty page cache’ or publishing or updating a post). But these manual actions aren’t enforcing the page cache expiry time (default 1 hour) in an automatic way. How is that achieved when the user isn’t clicking any buttons or editing posts?

    Can you explain more about the logic of the garbage collection process? Does it potentially need several iterations to complete if there are a lot of _old files present in the cache? (i.e. taking a multiple of the ‘garbage collection interval’ setting to complete).

    Thanks in advance.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How exactly are page cache files set as expired?’ is closed to new replies.