[wp-trac] [WordPress Trac] #40420: key/group naming confusion in _get_non_cached_ids()

WordPress Trac noreply at wordpress.org
Wed Apr 12 11:27:05 UTC 2017


#40420: key/group naming confusion in _get_non_cached_ids()
-----------------------------+------------------------------
 Reporter:  johnjamesjacoby  |       Owner:
     Type:  defect (bug)     |      Status:  new
 Priority:  normal           |   Milestone:  Awaiting Review
Component:  Cache API        |     Version:  3.9
 Severity:  normal           |  Resolution:
 Keywords:                   |     Focuses:  performance
-----------------------------+------------------------------
Changes (by johnjamesjacoby):

 * focuses:   => performance


Comment:

 [https://core.trac.wordpress.org/attachment/ticket/40420/40420.patch
 40420.patch] paints the bikeshed in the following ways:

 * Uses `$cache_group` instead of `$cache_key`
 * Updates "cache bucket" documentation to "cache group"

 Notes:

 * Core mostly `$group` instead of `$cache_group` everywhere else but 1
 place (the customizer) which was newly introduced in 4.7.0. (See:
 `WP_Customize_Manager->find_changeset_post_id()`)
 * My personal preference would be to use `$cache_group` everywhere, but
 that's a lot of code-churn
 * `$group` reads too ambiguously to me, especially given the context of
 BuddyPress Groups

 Additional findings:

 * We do `!wp_cache_get()` here, which might actually be a logic error.
 It's plausible this should be a strict `false` comparison, as the intended
 functionality is to identify totally uncached keys, and not a value that
 might be an empty string or array. (This type of problem exists through-
 out WordPress already though.)
 * See #22174 & #20875 for other nice improvements to this function

--
Ticket URL: <https://core.trac.wordpress.org/ticket/40420#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list