You are here

public function AccessResultCache::hasAccessResultsCache in Permissions by Term 8.2

File

src/Cache/AccessResultCache.php, line 61

Class

AccessResultCache

Namespace

Drupal\permissions_by_term\Cache

Code

public function hasAccessResultsCache(int $accountId, $entityId) : bool {
  $cid = 'permissions_by_term:access_result_cache:' . $entityId . ':' . $accountId;
  $staticCache =& drupal_static(__FUNCTION__ . $cid, NULL);
  if ($staticCache) {
    $data = \unserialize($staticCache);
    if (!$data instanceof AccessResult) {
      return FALSE;
    }
    return TRUE;
  }
  $result = $this->cache
    ->get($cid);
  if (!isset($result->data)) {
    return FALSE;
  }
  $data = \unserialize($result->data);
  if (!$data instanceof AccessResult) {
    return FALSE;
  }
  return TRUE;
}