• Thanks a lot for this great plugin. We are using memcached for page caching.

    We are inspecting page cache functions in order to find out what happens when the awesome cache preload feature is used. As far as we see, cache preload does not force a new page cache to be created if there is an existing cached version of the page.

    If that is true, a time gap comes up between expiration of the existing cache and cache preload. What we need is to have a cached version of the page anytime by overwriting and refreshing the existing cache before it expires.

    Internals: The class W3_PgCache controlling this process uses _can_cache() and _can_cache2() functions to decide. _can_cache() is used for reading existing cache, _can_cache2() is used for writing a new cache. _can_cache2() checks if _can_cache() is true, so if _can_cache() is false, neither existing cache is read, nor a new cache is written.

    What we need is to skip reading but write a new cache. For our quick and dirty tests, we changed the user agent in W3_Plugin_PgCacheAdmin->prime() when calling the requested page and checked the user agent in W3_PgCache->process() in order to skip only reading but not writing the cache. So we just changed the line

    if ($this->_caching) {

    to

    if ($this->_caching && !(isset($_SERVER['HTTP_USER_AGENT']) && $_SERVER['HTTP_USER_AGENT'] === 'RELOAD')) {

    This method seems to be working for us.

    We think this feature may be implemented as an option as forcing a new cache frequently will consume more resources for priming the cache which may not be preferred by everyone. Using the user agent string was the simplest way to test this, a better method can be implemented.

    Thank you.

    https://www.ads-software.com/plugins/w3-total-cache/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter BizBilisim

    (@bizbilisim)

    We are using this primitive method for about a month now and we are getting very good results. All of our ~1500 pages are always present in the cache.

    Do you plan to implement this feature in a more effective and compatible way?

    Yet another improvement, we disabled all of the “Purge Policy: Page Cache” options and added a custom function to the save_post hook, that simply reloads the post page, front page, term and archive page caches the same way with curl. This ensures there will be no cache miss when a new post is published as purge policy deletes the cache but does not creates a new one.

    I have the W3 total cache installed. I set it up to the exact specifications that the authors said to and the site loads MUCH faster. The problem is that now people have to MANUALLY refresh each page to see new content. Our blog has 1 to 3 new articles daily and this is a problem.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Cache Preload Force Refresh’ is closed to new replies.