Opened 8 years ago
Closed 8 years ago
#41847 closed enhancement (duplicate)
Add caching to WP_User_query
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 3.1 |
Component: | Users | Keywords: | has-patch |
Focuses: | performance | Cc: |
Description
Calls to WP_User_Query can be very expensive, as sites with public registration can have many users. The WP_Comment_Query, WP_Site_Query and WP_Network_Query classes all have caching enabled. All these classes, have a list of object ids and number of found items in cache. This caching should be added to user queries.
Attachments (1)
Change History (4)
Note: See
TracTickets for help on using
tickets.
First patch adds basic caching. It add cache invalidation for user meta, adding users to blogs and CRUD functions for users.
This changes all queries to be ids, get the whole user object. Then for fields queries, just pick off the fields out of the WP_User object that you want.
Other big change is to the
cache_users
function. This function is very similar to_prime_<type>_cache
function. I have added new param tocache_users
of$update_meta_cache
to optionally prime user meta caches.