Support » Plugin: LiteSpeed Cache » Tag Prefix

  • Resolved rochow

    (@rochow)


    We are setting tags, for example:

    add_action( 'init', 'a' );
    function a( $headers ) {
    	LiteSpeed_Cache_API::tag_add( 'roster' );
    }

    But to flush it:

    header( "X-LiteSpeed-Purge: tag=9a41_roster,tag=9a4_roster");

    Roster doesn’t actually work, it’s always got a prefix. This worked for a few months but now it’s changed slightly so I had to update it.

    – Why is it being prefixed?
    – How can I make it flush without having it break down the line and needing to find the new prefix and update the code?

    • This topic was modified 2 years, 7 months ago by rochow.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Hi @rochow,

    We do not recommend to use header for purging cache, please use LiteSpeed_Cache_API::purge($tag), for more details please check: https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:cache:lscwp:api

    Thanks,
    Stanley

    Thread Starter rochow

    (@rochow)

    Hi @stanleylitespeed,

    The application flushing the cache isn’t WordPress. That’s why we need to manually trigger it to flush certain pages on the WP site when other data changes.
    Is there another method?

    Thanks,

    Hi @rochow,

    Tag Prefix is used for defining the cache for specific WordPress document root, it will not change if the document root remains unchanged.

    It’s generated by the following function:

    substr( md5( LSCWP_DIR ), -3 )
    
    You can check the const LSCWP_DIR inside your WordPress to be safe.

    so you may use the same function to retrieve the LiteSpeed Tag Prefix.

    Thanks,
    Stanley

    Plugin Support Hai Zheng⚡

    (@hailite)

    The tag prefix was changed in 2.9.3 – FEB 20 2019 changelog, Tag: Only append blog ID to cache tags when site is part of a network.

    Please make sure the tag you used to purge matched the new tag. In your case, 9a4_ should be it.

    Thread Starter rochow

    (@rochow)

    The timing matches so that’ll be it. This site isn’t MU btw.

    I told the client I’d post it on the forum to find out because Litespeed support is great and you certainly delivered!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Tag Prefix’ is closed to new replies.