• Resolved PumpaXXL

    (@pumpaxxl)


    Hi,

    I’d like to clear and reload the cache once per day by external cron, pointing to my …/w3tc-clear-all-plus-divi.php url.

    I think the file should look like this:

    <?php 
    // Load WordPress.
    require( 'wp-load.php' );
    
    // Clear Divi cache (the theme static CSS files).
    if ( function_exists( 'et_core_page_resource_auto_clear' ) ) {
    	et_core_page_resource_auto_clear();
    }
    
    // Clear minified CSS and JavaScript files.
    if ( function_exists( 'w3tc_flush_all' ) ) {
    	w3tc_flush_all();
    }

    But it looks like the cache preload is not triggered by w3tc_flush_all(). Can you please recommend the function to start the preload?

    Thanks, great plugin!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter PumpaXXL

    (@pumpaxxl)

    Hi,

    it seems that the flush_all did triggered the preload but it brought something that I did not noticed before.

    The W3TC\PgCache_Plugin->prime() cron action was executed during each cron event even hours after all the pages were regenerated. Each w3_pgcache_prime takes 5, 8, 11 seconds or so. Every time I look at the cron tasks, the W3TC\PgCache_Plugin->prime() is in now position. Is it normal behaviour?

    I am new to W3TC and I usually don’t se primer active after cache preload is done with other caching solutions and each cron task is usually most often in tens of miliseconds. With W3TC it is always more than 5 secs.

    Thanks.

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @pumpaxxl

    Thank you for reaching out and I am happy to answer.
    This depends on the settings in the cache preload section. For example, if it’s set to default – Update interval 900s, Pages per interval 10, it means that the batch of 10 pages will be cached every 15 mins.
    The Preload never stops ??
    The main reason for this is if the cache is purged, the preload will start from the beginning, and also, if the cache was not purged for any reason, once the preload for all pages is done, the preload starts again to keep your cache warm and up to date.
    I hope this helps!
    Thanks!

    Thread Starter PumpaXXL

    (@pumpaxxl)

    I see. So if I have 80 pages, want to preload them at one batch in the midnight, I will set update interval to 90000 (25 hours), pages per interval to say 100 and run my php snippet from above in the midnigh, I will have cached files for the whole day, updated at midnight.

    Love it, thanks!
    Pavel.

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @pumpaxxl

    You are most welcome.
    Yes, that is correct.
    As a suggestion, you should test this and make sure that your server is able to cache the entire batch of 80 pages in one take.
    Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Cache flushing with cron’ is closed to new replies.