No support for wp_cache_flush_group()
The plugin has no support for wp_cache_flush_group():
https://developer.wordpress.org/reference/functions/wp_cache_flush_group/
This is explicitly defined inside this file here: https://github.com/litespeedtech/lscache_wp/blob/master/src/object.lib.php#L331
It's been years since WP added this wp_cache_flush_group(); function...when is this expect to be included?
This affects my workflow because on sites where I have custom plugins, I need to disable the litespeed plugin and install W3 Total Cache simply because sometimes the cache keys I create are dynamic, and the values used to create them are not always available in methods where I would want to clear those cache keys.
Being able to clear the entire group is far more efficient. Any plans on this?
@UVLabs Did you added an answer/created the topic: https://wordpress.org/support/topic/wp_cache_supports-flush_group/ ?
@timotei-litespeed So then can we get this merged? There's way too many changes happening in that pull request to reasonably ask users to manually add the changes to the plugin...
Its almost a year since that pull request was opened @hi-hai
@timotei-litespeed Can you work w/ OP and make sure the PR tested? We can merge this into v7.4
@UVLabs I will remake the PR and share it with you. We will work together on testing it
@timotei-litespeed You can ping me on the updated pull request when done... also let me know how to build the plugin files for production or even better...provide a built zip so i can download
@UVLabs OK :) For all sites we have LSC => Tolbox => Beta test where commits or version can be tested.
I started working here: https://github.com/timotei-litespeed/lscache_wp/tree/OC-improvements
BUT! is note tested! Please do not use it for now
@UVLabs please test with this implementation. https://github.com/timotei-litespeed/lscache_wp/commit/eb6900b70e8ca6c02fd276df38ade89dc0db47d3 Added some Debug messages, which I will remove later.
@timotei-litespeed I can't explain it...But I did a small test on a site with both LSC 7.2 and 7.3 without using your commit, and wp_cache_flush_group seems to be working from the test i did...
I'm looking at the LSC code for v7.3 and it's explicitly stating that it does not have support, yet when I run the test code, WP is not returning false for wp_cache_supports( 'flush_group' )
Here's the test snippet I used:
function sl_cc_test(){
if ( wp_cache_supports( 'flush_group' ) === false ) {
file_put_contents(ABSPATH . 'log.txt', "no support\n\n", FILE_APPEND);
}else{
file_put_contents(ABSPATH . 'log.txt', "has support\n\n", FILE_APPEND);
}
wp_cache_set('testing', 'hello there', 'lsc_group', DAY_IN_SECONDS);
// Uncomment line below to test cache flush
// wp_cache_flush_group('lsc_group');
$cache = wp_cache_get('testing', 'lsc_group');
if( $cache !== false ) {
file_put_contents(ABSPATH . 'log.txt', "cache hit\n\n", FILE_APPEND);
}else{
file_put_contents(ABSPATH . 'log.txt', "cache miss\n\n", FILE_APPEND);
}
}
add_action('admin_head', 'sl_cc_test');
The log file hows "has support" and when I uncomment the cache flush line, it shows cache miss. So it seems like the cache group is getting cleared somehow...I can't explain whats causing it if LSC specifies no support. I tested from a Namecheap hosting which installs the LSC plugin by default through Softaculous.
Any ideas why its working?
@UVLabs have you tried installing the dev code from this push: https://github.com/timotei-litespeed/lscache_wp/commit/eb6900b70e8ca6c02fd276df38ade89dc0db47d3 ? This can be done from LSC => Toolbox => Beta test => insert the commit in the input and click Update
@timotei-litespeed No i didnt, what im saying is even without adding that commit, LSC seems to work with wp_cache_flush_group as seen in the snippet i provided above. So im wondering how/why?
@timotei-litespeed did you see my last response here?
No i didnt, what im saying is even without adding that commit, LSC seems to work with wp_cache_flush_group as seen in the snippet i provided above. So im wondering how/why?
@UVLabs I saw but I was not able to get to this issue. Thank you for bumping the issue