[wp-trac] [WordPress Trac] #40613: Add query cache to WP_User_Query class

WordPress Trac noreply at wordpress.org
Tue Apr 18 11:49:02 UTC 2023


#40613: Add query cache to WP_User_Query class
-------------------------------------------------+-------------------------
 Reporter:  johnjamesjacoby                      |       Owner:
                                                 |  spacedmonkey
     Type:  enhancement                          |      Status:  closed
 Priority:  normal                               |   Milestone:  6.3
Component:  Users                                |     Version:  3.1
 Severity:  normal                               |  Resolution:  fixed
 Keywords:  has-patch needs-testing changes-     |     Focuses:
  requested                                      |  performance
-------------------------------------------------+-------------------------
Changes (by spacedmonkey):

 * status:  assigned => closed
 * resolution:   => fixed


Comment:

 In [changeset:"55657" 55657]:
 {{{
 #!CommitTicketReference repository="" revision="55657"
 Users: Cache database queries within `WP_User_Query` class.

 Cache the results of database queries within `WP_User_Query` class. Only
 cache queries that are requesting 3 or less fields so that caches are not
 storing full user objects. Cache results are stored in a new global cache
 group named `users-queries`. Add a new parameter to `WP_User_Query` called
 `cache_results` to allow developers to opt out of a receiving cached
 results. `cache_results` parameter defaults to true. Also add a new helper
 function called `wp_cache_set_users_last_changed`, similar to
 `wp_cache_set_posts_last_changed` that incroments last changed value in
 cache group `users`.  Ensure that `wp_cache_set_users_last_changed` is
 called whenever user / user meta is modified for proper cache
 invalidation.

 Props johnjamesjacoby, spacedmonkey, westi, dd32, strategio,
 srikanthmeenakshi, OllieJones, khoipro, rjasdfiii, flixos90, mukesh27,
 peterwilsoncc.
 Fixes #40613.
 }}}

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


More information about the wp-trac mailing list