You are here

protected function PhpBackend::getByHash in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Cache/PhpBackend.php \Drupal\Core\Cache\PhpBackend::getByHash()
  2. 9 core/lib/Drupal/Core/Cache/PhpBackend.php \Drupal\Core\Cache\PhpBackend::getByHash()

Fetch a cache item using a hashed cache ID.

Parameters

string $cidhash: The hashed version of the original cache ID after being normalized.

bool $allow_invalid: (optional) If TRUE, a cache item may be returned even if it is expired or has been invalidated.

Return value

bool|mixed

File

core/lib/Drupal/Core/Cache/PhpBackend.php, line 72

Class

PhpBackend
Defines a PHP cache implementation.

Namespace

Drupal\Core\Cache

Code

protected function getByHash($cidhash, $allow_invalid = FALSE) {
  if ($file = $this
    ->storage()
    ->getFullPath($cidhash)) {
    $cache = @(include $file);
  }
  if (isset($cache)) {
    return $this
      ->prepareItem($cache, $allow_invalid);
  }
  return FALSE;
}