public function AccessResultCache::getAccessResultsCache in Permissions by Term 8.2
File
- src/
Cache/ AccessResultCache.php, line 41
Class
Namespace
Drupal\permissions_by_term\CacheCode
public function getAccessResultsCache(int $accountId, $entityId) : AccessResult {
$cid = 'permissions_by_term:access_result_cache:' . $entityId . ':' . $accountId;
$staticCache =& drupal_static(__FUNCTION__ . $cid, NULL);
if ($staticCache) {
return \unserialize($staticCache);
}
$result = $this->cache
->get($cid);
$data = \unserialize($result->data);
if (!$data instanceof AccessResult) {
throw new \Exception("Unexpected result from cache. Passed accountId: {$accountId} - passed entityId: {$entityId}");
}
return $data;
}