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

WordPress Trac noreply at wordpress.org
Wed Apr 12 11:09:18 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           |   Keywords:
  Focuses:                   |
-----------------------------+-----------------------------
 The `_get_non_cached_ids()` function uses a parameter named `$cache_key`
 that actually represents a cache group everywhere else within WordPress.

 This means when looking at the block or inline documentations, a developer
 may accidentally be guided down the path of passing in an actual cache-key
 instead of the cache-group they're checking against.

 My recommendation would be to clarify this bit of code to use `$group` or
 `$cache_group` rather than `$cache_key`, and update any surrounding code
 documentation to be explicit if it needs it. It's a non-functional change,
 but will make the code more clear for people.

 (Related: BuddyPress comes packaged with it's own similar helper function,
 and opted to use `$cache_group`.)

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


More information about the wp-trac mailing list