[wp-trac] [WordPress Trac] #41197: Improved caching on WP_Site_Query

WordPress Trac noreply at wordpress.org
Mon Jul 3 10:43:59 UTC 2017


#41197: Improved caching on WP_Site_Query
--------------------------------------+------------------------------
 Reporter:  spacedmonkey              |       Owner:
     Type:  enhancement               |      Status:  new
 Priority:  normal                    |   Milestone:  Awaiting Review
Component:  Networks and Sites        |     Version:  4.6
 Severity:  normal                    |  Resolution:
 Keywords:  has-patch has-unit-tests  |     Focuses:  multisite
--------------------------------------+------------------------------

Comment (by flixos90):

 [attachment:41197.diff] looks good, there are just a few things that can
 be improved:

 * The `$fields` argument can always be unset, even if `$count` is true, as
 that parameter will already distinguish in the cache key between whether
 to store a count or not.
 * For the unit tests, it would be better to have three distinct tests
 (only one assertion per test):
     * Run the same query twice, once with `$fields` set to `all`, the
 other with `$fields` set to `ids`.
     * Another one similar to the above, but with `$count` set to `true` in
 both queries.
     * Run the same query twice (with the same `$fields` value!), but one
 time with the `$count` argument as true.

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


More information about the wp-trac mailing list