Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. PhpBackend.php

function 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

2 calls to PhpBackend::getByHash()
PhpBackend::get in core/lib/Drupal/Core/Cache/PhpBackend.php
Returns data from the persistent cache.
PhpBackend::invalidateByHash in core/lib/Drupal/Core/Cache/PhpBackend.php
Invalidate one cache item.

File

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

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;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal