• Resolved vdl

    (@dellalibera)


    Hi everyone, we are using redis cache on our website and we have noticed a substantial improvement in database requests when the listing grid is loaded. However, when a new post is added, the redis cache needs to be cleared completely. Does anyone know how to clear only the redis cache of the CPT or of a URL? Even if it is via the command line, is there a way to do this without having to clear the entire cache?

    Even if it is not clearing the cache, but signaling redis to update the cache of that URL on the next load would also solve the problem.

    Is there any way to do this? It’s heartbreaking to see a nice 2GB cache being wiped.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Till Krüss

    (@tillkruess)

    You can use wp_cache_flush() to wipe the entire cache or clean_post_cache() to clear a specific post.

    Thread Starter vdl

    (@dellalibera)

    Hello @tillkruess ,

    I tried your suggestion by doing it this way in my functions.php, but the cache is still inside redis. I didn’t test it with W3 Total Cache, because I saw that this is a native WordPress function. Do you think it would be different if I had w3 installed? I can do this.

    function test_clean_cache() {

    $page_id = 343702;
    clean_post_cache($page_id);

    }
    add_action('wp', 'test_clean_cache');

    Plugin Author Till Krüss

    (@tillkruess)

    Yes, it might still be cached in your page cache. clean_post_cache() only flushes the object cache.

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