• Resolved ahojdane

    (@ahojdane)


    Hello,

    LiteSpeed Cache Settings – Purge – Auto Purge Rules For Publish/Update.

    Even if all the options are unchecked, on any update of any page a purge of everything is executed. Any ideas how to fix this?

    I’m using latest version of WP 6.5.3. and LiteSpeed Cache plugin for WP 6.2.0.1.?Also latest version of Polylang Pro 3.6.1.

    LiteSpeed Report
    Report number:?OVIFTVCS

    Before logging I unchecked all the checkboxes at
    LiteSpeed Cache Settings – Purge – Auto Purge Rules For Publish/Update
    Debug log: https://pastebin.com/zCdSDSsE
    Purge log: https://pastebin.com/8x2wbT1x

    The Polylang team investigated this issue and the answer from them is:

    I’ve shared the debug.log with my developers colleagues and they confirmed something seems to be wrong after Polylang Pro asked for flushing the cache of only 1 post.
    We can read in the debug.log

    /home5/adviocz/jidlonacestach.cz/wp-content/plugins/polylang-pro/modules/sync-post/sync-post-model.php@3329
    05/06/24 17:44:48.925 [217.30.64.206:61251 1 ZLC]  X-LiteSpeed-Purge: public,d64_
    05/06/24 17:44:48.925 [217.30.64.206:61251 1 ZLC]  Failed to flush object cache due to object cache not enabled
    05/06/24 17:44:48.925 [217.30.64.206:61251 1 ZLC]  Failed to reset opcode cache due to opcache not enabled
    05/06/24 17:44:48.925 [217.30.64.206:61251 1 ZLC]  Purge all => LiteSpeed\Root::debug( Purge all ,3)@51 => LiteSpeed\Purge->_purge_all()@212 => LiteSpeed\Purge::purge_all(954)@178 => WP_Hook->apply_filters(,ARRAY)@326

    After Polylang is asking for flushing the synchronized post cache (only one post ID), we can see Lite Speed cache is flushing it entirely:

    LiteSpeed\Root::debug( Purge all ,3)@51 => LiteSpeed\Purge->_purge_all()@212 => LiteSpeed\Purge::purge_all(954)@178 => WP_Hook->apply_filters(,ARRAY)@326

    Would you please contact them to know on which hook they attach this purge_all() function ?

    Any idea how to fix this issue?

    This is not a new problem, but I’m trying to solve it now, because I have feedback from Polylang team.

    Thank you!

Viewing 15 replies - 1 through 15 (of 21 total)
  • Plugin Support qtwrk

    (@qtwrk)

    I think they called wrong hook

    please try not use purge_all , but only the purge by post ID

    ref: https://docs.litespeedtech.com/lscache/lscwp/api/#purge-a-single-post-by-id

    Thread Starter ahojdane

    (@ahojdane)

    Thank you. The answer from the Polylang team is:

    As per my memory, we’re using the purge_all function with a post_ID so, it should empty only this postID cache.
    We won’t change this behaviour just for LiteSpeed cache when it works well with all other cache plugins.
    I think LS cache plugin should correct their code and empty the cache of the post_ID in parameter only, and not of the entire cache.
    Basically, Polylang doesn’t empty any cache. It asks plugin cache to do… with parameter, if the plugin doesn’t follow the instruction, we can’t do anything.

    If I get they answer right, they call the purge_all function with the post_D as it should be …

    Any ideas? Thank you!

    Plugin Support qtwrk

    (@qtwrk)

    the purge_alll , well , it purges … all , as name suggests

    in case , need to purge individual post ID, please use this code

        if (defined('LSCWP_V')) {
    do_action( 'litespeed_purge_post', $post );
    }

    you can try somethign like this

    function lscwp_suppress_purge_update( $new_status, $old_status, $post ) {
        ob_start( function($buffer) use ($post) {
            @header("X-LiteSpeed-Purge: " . LSWCP_TAG_PREFIX . "_Po." . $post->ID );
            return $buffer;
        } );
        
    }
    add_action( 'transition_post_status', 'lscwp_suppress_purge_update', 10, 3 );

    this code snippet should suppress whatever previous purge call was , and overrides it to “purge this post ID” only

    although ideally , it’s more preferable that Polylang team can update their code from “pruge all” to “purge post by id”

    Sébastien SERRE

    (@sebastienserre)

    Hello @qtwrk

    This is Sebastien from Polylang Pro team.

    I think there’s a misurderstood, on line provided in the debug.log, we’re using https://developer.www.ads-software.com/reference/functions/clean_post_cache/, this is LiteSpeed Cache which is performing a “purge_all”, not Polylang Pro.

    Would you please contact us directly at https://polylang.pro/support ?
    We can’ t provide support for Premium plugins on this forum.

    Regards

    Plugin Support qtwrk

    (@qtwrk)

    hi @sebastienserre , just submit a contact ??

    Thread Starter ahojdane

    (@ahojdane)

    Thank you, qtwrk and Sébastien!

    Just for sure, this is my cache settings:
    https://pasteboard.co/Se7quiehuo4W.png

    With this settings, purge all happens in many cases. For example:
    – I edit some page -> purge all (posts, pages, categories, tags)
    – I edit some category (description) -> purge all (posts, pages, categories, tags)
    See: https://pasteboard.co/oT1VkwiwX8ri.png

    If I activate the code from qtwrk and edit some post or page, it is working fine, no purge all applied (only the edited post/page is purged).
    But even with this activated code the purge all is applied if I edit a category or tag.

    Thank you!

    Plugin Support qtwrk

    (@qtwrk)

    that notification will always be there even with my code snippet, please try verify the http response header

    Thread Starter ahojdane

    (@ahojdane)

    I checked the info at the end of the page in the source code:

    <!-- Page cached by LiteSpeed Cache 6.2.0.1 on 2024-05-20 17:20:39 -->

    This information is changing.

    Thread Starter ahojdane

    (@ahojdane)

    It can also be noticed from the page generation time (from the instant display (cache) to the new cache generation (several seconds). But that’s subjective, I admit. However, the caching time changes in the page’s source code.

    Plugin Support qtwrk

    (@qtwrk)

    yeah … okay , I guess my code was fired too early and later on the polylang code overrides me ??

    Thread Starter ahojdane

    (@ahojdane)

    No, your code is working fine.

    With your code activated:
    – if I edit page/post, only this page/post cache is purged, everything other stays cached
    – if I edit category/tax, everything is purged (even with your code activated, but this is expected (I think, your code was written only for page/post).

    Did I write it clearly? ??

    Plugin Support qtwrk

    (@qtwrk)

    oh yes , because that code only covers the post update , not with cat/tax update

    Thread Starter ahojdane

    (@ahojdane)

    I tried to replicate this behavior. Twice ??

    Brand new, clean install of latest WP. Only two plugins (latest Litespeed Cache and Polylang FREE).
    https://pasteboard.co/4NLTDZfW7n9G.png

    The same cache settings:
    https://pasteboard.co/Se7quiehuo4W.png

    3 languages as in my production webserver.

    Same problem ??

    Thread Starter ahojdane

    (@ahojdane)

    @sebastienserre

    This is problem also of the FREE version ??
    https://pasteboard.co/4NLTDZfW7n9G.png

    We can’ t provide support for Premium plugins on this forum.

    Thread Starter ahojdane

    (@ahojdane)

    Please, @qtwrk , do you have solution like this:

    function lscwp_suppress_purge_update( $new_status, $old_status, $post ) {
        ob_start( function($buffer) use ($post) {
            @header("X-LiteSpeed-Purge: " . LSWCP_TAG_PREFIX . "_Po." . $post->ID );
            return $buffer;
        } );
        
    }
    add_action( 'transition_post_status', 'lscwp_suppress_purge_update', 10, 3 );

    also for category/tag?

    Thank you very much!

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