Statically caches whether the given user has access.
\Drupal\Core\Entity\EntityInterface $entity: The entity for which to check 'create' access.
string $operation: The entity operation. Usually one of 'view', 'edit', 'create' or 'delete'.
string $langcode: The language code for which to check access.
\Drupal\Core\Session\AccountInterface $account: The user for which to check access.
bool TRUE if access was granted, FALSE otherwise.
protected function setCache($access, EntityInterface $entity, $operation, $langcode, AccountInterface $account) {
$uid = $account ? $account
->id() : 0;
$uuid = $entity
->uuid();
// Save the given value in the static cache and directly return it.
return $this->accessCache[$uid][$uuid][$langcode][$operation] = (bool) $access;
}