Author: Stasyuk Eugene 105 15.03.2024

Cloudabove has the ability to speed up a site by caching on the server. By default, this cache is cleared every 15 minutes. This speeds up the site quite a bit, but it also affects the display of content. For example, in my case, a product review posted by a user did not appear until 15 minutes later.

Clearing the cache is pretty simple. It is based on a GET request to https://scout.cloudabove.com/api/cache/purge. It is important that the request comes from your server, otherwise the API will not accept the request.

In the case of Woocommerce reviews, we will use the comment_post hook and the wp_remote_get() function

function clear_server_cache($comment_id, $comment_approved) {

    if($comment_approved == 1){
        wp_remote_get('https://scout.cloudabove.com/api/cache/purge', array('timeout' => 5));
    }
}

add_action( 'comment_post', 'clear_server_cache', 20, 2 );

In addition, we can clear the cache from the site’s admin area using the button

To make it available, you need to place this file scout-cache-helper.php in the wp-content/mu-plugins folder of our website.

Other articles

Simple star rating stars

Simple star rating

Simple star rating

In this article, I will show you how to make the visual part of the star rating. Namely: Finished option: Markup As a markup, we have a container block with the .rate class inside which I have placed 5 links. I used a font as a star. But most likely in practice you will have […]

Show your work presentation

Show your work

Show your work

I recently read Austin Kleon’s book “Show Your Work”. Left a very good impression. Thanks to her, I slightly changed my views on my work and on the process itself as a whole. Why did she impress me so much?  The message of this book is quite simple: show your work, including the process of […]