You are here

public function CompanyMembershipObjectCache::getMembership in Apigee Edge 8

Returns membership object from the cache.

Parameters

string $company: Name of a company.

Return value

\Apigee\Edge\Api\Management\Structure\CompanyMembership|null Membership object with the members or null if no entry found for the given company in the cache.

Overrides CompanyMembershipObjectCacheInterface::getMembership

File

modules/apigee_edge_teams/src/CompanyMembershipObjectCache.php, line 142

Class

CompanyMembershipObjectCache
Providers a persistent & non-persistent cache for company membership objects.

Namespace

Drupal\apigee_edge_teams

Code

public function getMembership(string $company) : ?CompanyMembership {
  if ($data = $this->memoryCache
    ->get($company)) {
    return $data->data;
  }
  if ($data = $this->persistentCacheBackend
    ->get($company)) {

    // Next time return this from the memory cache.
    $this->memoryCache
      ->set($company, $data->data);
    return $data->data;
  }
  return NULL;
}