[wp-trac] [WordPress Trac] #47884: Unable to remove "counts" from non persistent cache groups
WordPress Trac
noreply at wordpress.org
Thu Oct 24 21:04:44 UTC 2019
#47884: Unable to remove "counts" from non persistent cache groups
--------------------------------------+------------------------------
Reporter: Maciej Laskowski | Owner: (none)
Type: defect (bug) | Status: assigned
Priority: normal | Milestone: Awaiting Review
Component: Cache API | Version: 2.6
Severity: normal | Resolution:
Keywords: dev-feedback 2nd-opinion | Focuses: performance
--------------------------------------+------------------------------
Changes (by desrosj):
* keywords: dev-feedback => dev-feedback 2nd-opinion
* version: 3.0 => 2.6
Comment:
@maciej-laskowski Welcome to Trac!
For the time being, I think this could be solved by modifying the drop-in.
Looking at the drop-in you linked to, it seems that you could just check
if `counts` is a value in `WP_Object_Cache::add_non_persistent_groups()`
([https://github.com/tillkruss/redis-
cache/blob/9e7cebb19daeca070c6a793ae846d77c7b9aa69f/includes/object-
cache.php#L1312 this line]) and remove it before updating the list of
groups.
As for fixing this in Core, I don't know much about the history of the
groups coded to not persist with `wp_cache_add_non_persistent_groups()`.
I'd love to get some feedback from others a bit more experienced with the
history (maybe @boonebgorges, @spacedmonkey?), but I believe that the
cache entries in these groups are not reliably invalidated. Looking back,
this function was added in [7986] (see #6740). My hunch is that you will
have issues with cache invalidation if you are not very careful with this.
Side note: the code block you linked to is in a conditional that checks
for the existence of `wp_cache_add_global_groups()`, but assumes the
existence of `wp_cache_add_non_persistent_groups()`. It may be good to add
a `function_exists( 'wp_cache_add_non_persistent_groups' )` check there as
a precaution (maybe with a `_doing_it_wrong()`?).
--
Ticket URL: <https://core.trac.wordpress.org/ticket/47884#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list