You are here

protected function MembershipManager::cacheMembershipIds in Organic groups 8

Stores the given list of membership IDs in the static cache backend.

Parameters

string $cid: The cache ID.

array $membership_ids: The list of membership IDs to store in the static cache.

2 calls to MembershipManager::cacheMembershipIds()
MembershipManager::getGroupMembershipIdsByRoleNames in src/MembershipManager.php
Returns the membership IDs of the given group filtered by role names.
MembershipManager::getMemberships in src/MembershipManager.php
Returns the group memberships a user is associated with.

File

src/MembershipManager.php, line 508

Class

MembershipManager
Service for managing memberships and group content.

Namespace

Drupal\og

Code

protected function cacheMembershipIds($cid, array $membership_ids) {
  $tags = Cache::buildTags('og_membership', $membership_ids);

  // Also invalidate the list cache tags so that if a new membership is
  // created it will appear in this list.
  $tags = Cache::mergeTags([
    'og_membership_list',
  ], $tags);
  $this->staticCache
    ->set($cid, $membership_ids, Cache::PERMANENT, $tags);
}