Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
03/03/2014 01:48:45 AM (11 years ago)
Author:
boonebgorges
Message:

Caching improvements related to bp_core_get_user_displayname()

  • The cache check in BP_XProfile_Data::exists() should be aware that cache misses are stored as objects and check for misses accordingly
  • Ensure that fullname cache is busted when field 1 is updated
  • Some unit tests
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-xprofile/bp-xprofile-cache.php

    r7975 r8022  
    132132}
    133133add_action( 'xprofile_updated_profile', 'xprofile_clear_profile_data_object_cache'   );
     134
     135/**
     136 * Clear the fullname cache when field 1 is updated.
     137 *
     138 * xprofile_clear_profile_data_object_cache() will make this redundant in most
     139 * cases, except where the field is updated directly with xprofile_set_field_data()
     140 *
     141 * @since BuddyPress (2.0.0)
     142 */
     143function xprofile_clear_fullname_cache_on_profile_field_edit( $data ) {
     144    if ( 1 == $data->field_id ) {
     145        wp_cache_delete( 'bp_user_fullname_' . $data->user_id, 'bp' );
     146    }
     147}
     148add_action( 'xprofile_data_after_save', 'xprofile_clear_fullname_cache_on_profile_field_edit' );
    134149
    135150/**
Note: See TracChangeset for help on using the changeset viewer.