[wp-trac] [WordPress Trac] #56605: Move supports_group_flush

WordPress Trac noreply at wordpress.org
Mon Sep 19 15:34:38 UTC 2022


#56605: Move supports_group_flush
-----------------------------+-------------------------------------------
 Reporter:  johnjamesjacoby  |      Owner:  (none)
     Type:  defect (bug)     |     Status:  new
 Priority:  normal           |  Milestone:  6.1
Component:  Cache API        |    Version:  trunk
 Severity:  normal           |   Keywords:  2nd-opinion changes-requested
  Focuses:                   |
-----------------------------+-------------------------------------------
 r53767 introduced the ability to flush cache groups via #4476, but I
 believe it may include a non-trivial oversight.

 The new `wp_cache_supports_group_flush()` function simply returns `true`
 or `false`, and will require a drop-in plugin to redefine this function in
 a pluggable way to override its return value.

 This approach does not empower the `$wp_object_cache` global Class to
 define for itself whether or not its backend supports flushing by cache
 group. Instead, it relies on the internal exceptions of
 `wp_start_object_cache()` to skip loading `wp-includes/cache.php` (which
 returns unpluggable `true`) and load `wp-includes/cache-compat.php` (which
 returns pluggable `false`).

 This makes this new "flag" or "setting" unique relative to the other Cache
 API functions located in `wp-includes/cache.php`, which my intuition tells
 me is likely not the ideal DUX, or an intentional implementation detail
 for this new feature in WordPress 6.1.

 ----

 I would like to politely suggest that before 6.1 ships without it, that
 the `WP_Object_Cache` be considered to have added to it some method of
 checking and reporting if the cache backend it interfaces with supports
 flushing groups (or potentially any future thing?)

 Perhaps that means a new `WP_Object_Cache::supports( $feature = '' ) {}`
 method and a new `wp_cache_supports( $feature = '' ) {}` function?

 Perhaps that just means a new `WP_Object_Cache::can_flush_groups()` method
 specifically (though, I'd hate to add it now with the idea of deprecating
 it later for `supports()` anyways.)

 Thoughts?

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/56605>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list