Tagged: 

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #41853
    Shannon Hicks
    Guest

    I’m looking to do caching & CDN for a high-traffic website that needs timely updates. The problem is that the content that is updated is driven by an external resource, and embedded in the wordpress site via a plugin. I understand that wouldn’t trigger Total Cache to update it’s local cache or invalidate the CDN cache… I’m hoping that there’s an API I can call to invalidate a single page manually. I’m not having much luck finding an answer to that question, though.

    #41864
    Marko Vasiljevic
    Keymaster

    Hello Shannon,

    Thank you for reaching out and I am happy to assist you with this.
    Short answer -yes. In wp-content/plugins/w3-total-cache/w3-total-cache-api.php you can find the purge functions.
    In your case:

    function w3tc_flush_post( $post_id, $extras = null ) {
    	$o = \W3TC\Dispatcher::component( 'CacheFlush' );
    	$o->flush_post( $post_id, $extras );

    or you can call flush for the URL:

    
    function w3tc_flush_url( $url, $extras = null ) {
    	$o = \W3TC\Dispatcher::component( 'CacheFlush' );
    	$o->flush_url( $url, $extras );
    

    As you can see you can call w3tc_flush_post( $post_id ) or w3tc_flush_url($url)
    I hope this helps!
    Thanks!

Viewing 2 posts - 1 through 2 (of 2 total)
  • The topic ‘Does Total Cache have an API?’ is closed to new replies.