Opened 8 years ago
Closed 8 years ago
#41197 closed enhancement (fixed)
Improved caching on WP_Site_Query
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 4.9 | Priority: | normal |
| Severity: | normal | Version: | 4.6 |
| Component: | Networks and Sites | Keywords: | has-patch has-unit-tests |
| Focuses: | multisite | Cc: |
Description
In WP_Site_Query, queries are cached as a list of site ids. The key cache is generated using the query args. But even through the values in the cache are the same, if you query by 'fields' => 'all' and 'fields' => 'ids', two caches are generated. By unsetting the 'fields' arg before generating the cache key, both queries will use the same cache.
Attachments (2)
Change History (8)
#3
@
8 years ago
- Milestone changed from Awaiting Review to 4.9
- Owner set to spacedmonkey
- Status changed from new to assigned
Per discussion with @spacedmonkey, he'll take care of what still needs to happen here.
Note: See
TracTickets for help on using
tickets.
41197.diff looks good, there are just a few things that can be improved:
$fieldsargument can always be unset, even if$countis true, as that parameter will already distinguish in the cache key between whether to store a count or not.$fieldsset toall, the other with$fieldsset toids.$wpdb->num_queriesshould match.$countset totruein both queries.$wpdb->num_queriesshould match.$fieldsvalue!), but one time with the$countargument as true.$wpdb->num_queriesshould differ.