• Resolved eddr

    (@eddr)


    Hi

    Using W3TC for quite some time.


    In a WooCommerce website with the builtin W3TC CloudFlare extension enabled, authorized and working, I want to flush product categories using w3tc_flush_url ( or another method ), but it doesn’t seem to work while w3tc_flush_all does.

    Any clue?

    Thanks

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

    (@vmarko)

    Hello @eddr

    Thank you for reaching out and I am happy to help!
    Most likely the product categories are not cached in the W3 Total Cache, and are cached on Cloudflare only. In this case, when you call w3tc_flush_url and the cache is not found the cache will not be triggered.
    This being said, w3tc_flush_all triggers as it says all cache flush.
    In this case, you can always purge the Cloudflare manually.

    I hope this helps!

    Thanks!

    Thread Starter eddr

    (@eddr)

    Thanks for the response

    Why do you think the page cache for the product category doesn’t exist?
    I double checked again and it exists and works.

    And anyway it makes sense to be able to control CF cache via W3TC functions. I see no such function for CF really. Can you refer me to such an API functionality within W3TC to purge specific CF url?

    I find it quite important…

    Thanks

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @eddr

    Thank you for your feedback.
    If this exists, it is purged. You mentioned that it’s not purged from the Cloudflare.
    Can you pleas sahre any evidence on how you see that it’s not purged there? Can you please also share how are you using the actions? Are you refering to the flush all button and purge current page button?

    Thanks!

    Thread Starter eddr

    (@eddr)

    Thanks

    1. Code, no buttons:

    // Not working:
    w3tc_flush_url(‘https://notreallymyweb.site/product-category/coffees/’);

    or

    w3tc_flush_url(‘https://notreallymyweb.site/product-category/coffees’);

    // Working:
    w3tc_flush_all();

    2. Evidence: developer tools show HIT as cf-cache-status, please check the screenshot:

    https://ibb.co/C9TgGRW

    And more – when cache is flushed, the page takes few seconds to load instead of 80ms on my end. Also contents don’t change.. and so on.

    3. The W3TC cache does get flushed. I see it via the cache folder and ofcourse, the time the category page takes to load.

    • This reply was modified 2 months, 3 weeks ago by eddr.
    Thread Starter eddr

    (@eddr)

    Hi
    Waiting for an update

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @eddr

    Thank you for your feedback.
    Does the URL you aded to purge actualy exists? It may be formatting so can you please sahre the actual url and wrap it in code?
    What you can do is hook onto the post-update hook, fetch all posts in the same tag/category and call w3tc_flush_url($url) on those posts.

    Thanks!

    Thread Starter eddr

    (@eddr)

    Thanks

    Yes, the URL actually exists and in use. Its local page cache is flushed by using our simple cide – double checked again.

    The CF cache for this page isn’t flushed.

    Looking at the “Extension_CloudFlare_Plugin.php” code I see no reference to w3tc_flush_url:

    function run() {
        add_filter( 'w3tc_config_default_values', array(
                $this, 'w3tc_config_default_values' ) );
    
        add_action( 'wp_set_comment_status',
            array( $this, 'set_comment_status' ), 1, 2 );
    
        // priority is important, see do_action call of that action
        add_action( 'w3tc_flush_all', array( $this, 'w3tc_flush_all' ), 3000, 1 );
    
        add_filter( 'w3tc_flush_execute_delayed_operations',
            array( $this, 'w3tc_flush_execute_delayed_operations' ), 3000, 1 );
    
        $this->fix_remote_addr();
    
        // if page caching is enabled on CF - attach to post modifications
        // and flush it
        if ( $this->_config->get_boolean( array( 'cloudflare', 'pagecache' ) ) ) {
            Util_AttachToActions::flush_posts_on_actions();
    
            add_action( 'w3tc_flush_post',
                array( $this, 'w3tc_flush_xxx' ), 3000 );
            add_action( 'w3tc_flushable_posts', '__return_true', 3000 );
            add_action( 'w3tc_flush_posts',
                array( $this, 'w3tc_flush_xxx' ), 3000 );
        }
    }

    Please check the code and add a w3tc_flush_url functionality for CF

    Looking forward to hearing from you

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @eddr

    Sorry for the late reply

    I’ve checked this and there is no way to purge specific page from cloudflare and not purge the entire cloudflare. This being said, is the content updated if you only flush the w3tc single page?

    Thanks!

    Thread Starter eddr

    (@eddr)

    Thanks

    1. Could you add such an option? Why should the whole CF cache be flushed, that’s far from optimal for a busy site.
    2. I don’t understand your question.. The whole problem is that the content doesn’t change when trying to flush only one page
    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @eddr

    Sorry for the late reply.

    We were not able to replicate this.
    Please reach out to us direcly via the plugin in Performance>Support so we can check this for you

    Thanks!

Viewing 10 replies - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.