Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
02/27/2018 01:29:33 PM (6 years ago)
Author:
dcavins
Message:

Change check in BP_Friends_Friendship::check_is_friend().

In BP2.5, we introduced a new friendship caching mechanism that created a new cache item containing all of a user's friendships. This approach worked well on sites with fewer friendships per user, but caused cache access issues on sites with lots of friendship connections.

This update replaces the cache-intensive change to BP_Friends_Friendship::check_is_friend() with a return to a single lookup to determine friendship status between two users. To minimize SQL lookups, individual friendships are now cached, and a new cache-warming function has been added to bulk update these new cache items: BP_Friends_Friendship::update_bp_friends_cache().

Props januzi_pl, boonebgorges, r-a-y, djpaul, dcavins.

Fixes #7436.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-friends/bp-friends-filters.php

    r11124 r11865  
    3535    $maybe_friend_ids = wp_parse_id_list( $user_ids_sql );
    3636
     37    // Bulk prepare the friendship cache.
     38    BP_Friends_Friendship::update_bp_friends_cache( $user_id, $maybe_friend_ids );
     39
    3740    foreach ( $maybe_friend_ids as $friend_id ) {
    3841        $status = BP_Friends_Friendship::check_is_friend( $user_id, $friend_id );
Note: See TracChangeset for help on using the changeset viewer.