public function DeveloperCompaniesCache::saveCompanies in Apigee Edge 8
Saves developers' companies to cache.
Parameters
\Apigee\Edge\Api\Management\Entity\DeveloperInterface[] $developers: Developer entities.
Overrides DeveloperCompaniesCacheInterface::saveCompanies
File
- src/
Entity/ DeveloperCompaniesCache.php, line 59
Class
- DeveloperCompaniesCache
- Default non-persistent developer company membership cache implementation.
Namespace
Drupal\apigee_edge\EntityCode
public function saveCompanies(array $developers) : void {
/** @var \Apigee\Edge\Api\Management\Entity\DeveloperInterface $developer */
foreach ($developers as $developer) {
$tags = array_merge([
"developer:{$developer->getDeveloperId()}",
"developer:{$developer->getEmail()}",
], array_map(function (string $company) {
return "company:{$company}";
}, $developer
->getCompanies()));
$this->backend
->set($developer
->id(), $developer
->getCompanies(), CacheBackendInterface::CACHE_PERMANENT, $tags);
}
}