Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
05/21/2016 02:16:38 AM (10 years ago)
Author:
boonebgorges
Message:

Introduce caching for group memberships.

The new system works like this: The bp_groups_memberships_for_user cache
group stores arrays of membership IDs for individual users. The
bp_groups_memberships cache group stores data about individual memberships.
The new function bp_get_user_groups() populates a user's group memberships
from these caches, and filters them as requested in the function parameters.
Then, the various groups_is_user_*() functions use bp_get_user_groups()
instead of direct, uncached database queries to fetch their data.

In addition, the get_group_extras() method of BP_Groups_Group can now be
greatly simplified, since all necessary pre-fetching of current-user group
memberships happens via the bp_get_user_groups() cache.

Props boonebgorges, dcavins.
See #6327.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-groups/classes/class-bp-groups-component.php

    r10768 r10794  
    846846            'bp_group_admins',
    847847            'bp_group_invite_count',
    848             'group_meta'
     848            'group_meta',
     849            'bp_groups_memberships',
     850            'bp_groups_memberships_for_user',
    849851        ) );
    850852
Note: See TracChangeset for help on using the changeset viewer.