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

Breadcrumb

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

function PsrCachedReader::refresh

Used in debug mode to check if the cache is fresh.

Return value

bool Returns true if the cache was fresh, or false if the class being read was modified since writing to the cache.

1 call to PsrCachedReader::refresh()
PsrCachedReader::fetchFromCache in vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/PsrCachedReader.php

File

vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/PsrCachedReader.php, line 168

Class

PsrCachedReader
A cache aware annotation reader.

Namespace

Doctrine\Common\Annotations

Code

private function refresh(string $cacheKey, ReflectionClass $class) : bool {
    $lastModification = $this->getLastModification($class);
    if ($lastModification === 0) {
        return true;
    }
    $item = $this->cache
        ->getItem('[C]' . $cacheKey);
    if ($item->isHit() && $item->get() >= $lastModification) {
        return true;
    }
    $this->cache
        ->save($item->set(time()));
    return false;
}

API Navigation

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