Make WordPress Core

Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

#15715 closed enhancement (invalid)

Add page load caching to get_users_of_blog()

Reported by: yoavf's profile yoavf Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.0.2
Component: Users Keywords: needs-patch
Focuses: Cc:

Description (last modified by yoavf)

Theme authors often use get_users_of_blog() in various area to style/present blog authors. Unfortunately, the query resulting from this function isn't cached, and can be quite expensive in a large multisite environment.

Proposed patch adds simple caching to get_users_of_blog()

Attachments (1)

cache_get_users_of_blog.diff (541 bytes) - added by yoavf 13 years ago.

Download all attachments as: .zip

Change History (8)

#1 @yoavf
13 years ago

  • Description modified (diff)

#2 @Denis-de-Bernardy
13 years ago

  • Keywords needs-patch added; has-patch removed
  • Milestone changed from Awaiting Review to Future Release
  • Version set to 3.0.2

The cache also needs to be invalidated.

#3 @westi
13 years ago

This cache should only last for the page load so doesn't need invalidation.

It just needs registering as non-persistent in the right places with wp_cache_add_non_persistent_groups

#4 @westi
13 years ago

Probably should just be in the counts group in fact

#5 @yoavf
13 years ago

Rethinking this:

get_users_of_blog() returns the complete users objects for every users, yet scenarios where only user ids/nicenames/email are required, are the reason I opened this ticket in the first place.

A better solution would probably be to have a function that can return specific columns of the user table.
Does that make sense?

#6 @yoavf
13 years ago

  • Resolution set to invalid
  • Status changed from new to closed

Irrelevant, get_users_of_blog() has been deprecated in favor of get_users()
See #15053

#7 @ocean90
13 years ago

  • Milestone Future Release deleted
Note: See TracTickets for help on using tickets.