Adding non persistent groups doesn’t always work
-
I think I found an issue with your code that handles non persistent groups.
I need to prevent Redis from caching “alloptions” value, so I call the following code as early as possible (muplugins_loaded hook).
wp_cache_add_non_persistent_groups( array( 'options', 'main_site-options' ) );
Despite this, the “alloptions” value still comes from the internal $cache array in the WP_Object_Cache object in your plugin.
This is happening because the get function in WP_Object_Cache object first checks internal $cache and then checks whether it should be persisted.
I believe there are 2 possible fixes:
* change logic in WP_Object_Cache::get to check if the group is persistent before trying to retrieve it from internal cache
* change function WP_Object_Cache::add_non_persistent_groups to delete all already cached values that belong to one of the groups being added
- The topic ‘Adding non persistent groups doesn’t always work’ is closed to new replies.