Support » Plugin: WP REST Cache » Cache flush does not work in some situations

  • hello,

    I installed your cache, but in many situations there is no flush.

    – When I delete a comment in the admin, the cache is flushed, but if I press the button to cancel the deletion of the comment, the cache is not flushed again. So in the cache the comment is no longer there.

    – If a comment is put in the trash, the cache is flushed. but if I decide to restore the comment, the cache is not flushed

    – When I leave a comment on the blog (front end), the cache is not flush.

    – If I answer a comment in the admin, the cache is not flush.

    We use the API for our application, it is important that the cache is flush in all the necessary conditions.

    thank you in advance

Viewing 10 replies - 1 through 10 (of 10 total)
  • Thread Starter Djib's

    (@djibs13)

    Looking in the code I see that there are the actions
    it should work normally

    
    add_action( 'edit_comment', [ $caching, 'delete_comment_type_related_caches' ], 999, 2 );
    add_action( 'deleted_comment', [ $caching, 'delete_comment_related_caches' ], 10, 2 );
    add_action( 'trashed_comment', [ $caching, 'delete_comment_related_caches' ], 10, 2 );
    add_action( 'untrashed_comment', [ $caching, 'delete_comment_type_related_caches' ], 999, 2 );
    add_action( 'spammed_comment', [ $caching, 'delete_comment_related_caches' ], 10, 2 );
    add_action( 'unspammed_comment', [ $caching, 'delete_comment_type_related_caches' ], 999, 2 );
    add_action( 'wp_insert_comment', [ $caching, 'delete_comment_type_related_caches' ], 999, 2 );
    add_action( 'comment_post', [ $caching, 'delete_comment_type_related_caches' ], 999, 2 );
    

    I use APCu for object caching. the problem could come from there?

    I read in another post that you had issues with MemeCache(d) for object caching.

    My configuration :

    Wordpress 4.9.10
    PHP 7.3.9
    APCu for object caching
    Wp supercache

    • This reply was modified 2 years, 4 months ago by Djib's.
    • This reply was modified 2 years, 4 months ago by Djib's.
    • This reply was modified 2 years, 4 months ago by Djib's.
    Plugin Author Acato

    (@acato)

    Hi @djibs13

    Thank you for using our plugin!

    You say “in many situations there is no flush”, so there are situations where the cache is flushed? This question is just to be sure, because if there are situations with cache-flushing it might not be an issue with your configuration (for instance the memcache(d)-issue was always present).

    I must say we generally don’t use comments on the sites we build, so the comment-caching part is probably tested the least (it is tested of course, but since we don’t use it ourselves….). So I will have to do some extra testing to see if I can reproduce the cases you describe (thanks for the description of the cases by the way).

    Thread Starter Djib's

    (@djibs13)

    Hi,
    Thank your for your response.

    I just left comments in all possible ways (since the admin, or the site, not from the API), the cache does not flush.

    • This reply was modified 2 years, 4 months ago by Djib's.
    Plugin Author Acato

    (@acato)

    Hi @djibs13

    I tested all your use cases on a local installation and it worked as it should (flushing the cache at the correct time).

    Could you check Settings > “WP REST Cache” > Tab: “Endpoint API Caches” and search for the record with the comments cache (Request URI = /wp-json/wp/v2/comments) and click Details. I am interested in the information under “Cache info” (so not the “Cache data”, since that contains the actual comments and might contain personal data). I am hoping it will tell me something about the cause for this strange caching behaviour.

    Thread Starter Djib's

    (@djibs13)

    Hello,

    I just reactivate the plugin, here is the information you requested.

    https://i.imgur.com/tBYnAcK.jpg

    Apcu is installed on your server? (last version)
    and the plugin “APCu Object Cache Backend” ?

    • This reply was modified 2 years, 4 months ago by Djib's.
    Thread Starter Djib's

    (@djibs13)

    Hello,

    I just removed the wordpress plugin “APCu for object caching” to test. everything works normally when it is deleted.

    The problem comes from there.

    Is it possible to have a patch for it to work with this plugin?

    Thank you.

    Plugin Author Acato

    (@acato)

    Hi @djibs13

    Can you provide us with a link to this plugin? We will have to investigate why this is happening and if we can do anything to prevent it.

    Thread Starter Djib's

    (@djibs13)

    It’s on the wordpress website.

    https://wordpress.org/plugins/apcu/

    It is also necessary that APCU is on your server.

    https://pecl.php.net/package/APCu

    the problem comes only from the wordpress plugin.

    In my test I have only uninstalled the plugin, Apcu for the server is still installed

    Plugin Author Acato

    (@acato)

    Hi @djibs13

    We will have to investigate this issue, but I must admit it will be low on our priorities-list. The plugin you are refering to has fewer than 10 active installations, so we are not sure if we are willing to invest the time needed to support such a plugin (it is very hard to support every plugin that exists).

    By the way: are you aware of the downside of APCu? The fact that it is local to the machine it runs on and local to the PHP process and system? That means that if you use PHP as a FastCGI process (like Nginx and PHP-FPM) every PHP process will have its own cache. If that is the case for you than I can tell you right away that there is nothing we can do to make it work.

    I hope you understand.

    Thread Starter Djib's

    (@djibs13)

    Hello,

    I understand.

    While waiting for a better solution, I will deactivate the APCU wordpress plugin.
    Thanks for your help

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Cache flush does not work in some situations’ is closed to new replies.