Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
09/27/2017 10:24:10 AM (6 years ago)
Author:
johnjamesjacoby
Message:

Members: trust WP_User::get_data_by() and eliminate an additional user cache layer.

This change removes ye olde bp_core_userdata_ cache key system, relying 100% on the baked-in object cache for user data and improving the liklihood of cache hits (particularly when other membership or community plugins are looking for user data outside of a BuddyPress specific context.)

For example, bbPress will look for authors of topics and latest posts on various forum pages, but BuddyPress will want to make sure it's XProfile Field display names are used. Previous to now, BuddyPress would need to re-query for these users and keep a separate cache of them. By relying on the traditional user objects, those duplicate database queries never happen, resulting in much joy.

This additionally improves page performance throughout the entire application. When user accounts are updated (via XProfile or related) and then immediately prime their caches, there is no more secondary BuddyPress-specific user object cache to prime.

Fixes #7595.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-settings/bp-settings-actions.php

    r11704 r11705  
    179179        // on the current page load.
    180180        if ( ( false === $email_error ) && ( false === $pass_error ) && ( wp_update_user( $update_user ) ) ) {
    181             wp_cache_delete( 'bp_core_userdata_' . bp_displayed_user_id(), 'bp' );
    182181            $bp->displayed_user->userdata = bp_core_get_core_userdata( bp_displayed_user_id() );
    183182        }
     
    455454
    456455        if ( $email_changed ) {
    457             // Delete object cache for displayed user.
    458             wp_cache_delete( 'bp_core_userdata_' . bp_displayed_user_id(), 'bp' );
    459456
    460457            // Delete the pending email change key.
Note: See TracChangeset for help on using the changeset viewer.