• The website have > 10k pages, all cached. But specific pages (like home page) i need to flush every 1 minute or on specific event. How to do that with w3tc? Totally disable cache for specific page is not good idea cause i want to get it cached. But updated after some event/by calling php function.

    Thanks in advance.

    • This topic was modified 6 years, 4 months ago by iShr00m.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor gidomanders

    (@gidomanders)

    You can prime page cache for a specific page with this code:

    
    $w3_pgcache = \W3TC\Dispatcher::component( 'CacheFlush' );
    $w3_pgcache->prime_post( $post_id );
    
    • This reply was modified 6 years, 4 months ago by gidomanders.
    Thread Starter iShr00m

    (@ishr00m)

    Thank you! But how to purge home page if no post_id?

    Plugin Contributor gidomanders

    (@gidomanders)

    I can only find the prime_post, not a similar functionality specific for the homepage. What you could do is use flush_url instead of prime_post and then directly after perform a get request to the homepage using curl or file_get_contents. That’s how the plugin works too, so that should get your problem solved.

    Thread Starter iShr00m

    (@ishr00m)

    It works good, thank you so much!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Flush cache for specific page’ is closed to new replies.