You are here

protected function MemcachedBackend::isValid in Memcache Storage 8

Validates a cached item.

Checks that items are either permanent or did not expire.

1 call to MemcachedBackend::isValid()
MemcachedBackend::getMultiple in src/MemcachedBackend.php
Returns data from the persistent cache when given an array of cache IDs.

File

src/MemcachedBackend.php, line 99

Class

MemcachedBackend

Namespace

Drupal\memcache_storage

Code

protected function isValid($cache) {
  if (!isset($cache->data)) {
    return FALSE;
  }

  // Check expire time.
  $cache->valid = $cache->expire == Cache::PERMANENT || $cache->expire >= REQUEST_TIME;

  // Make sure that cache tags were not expired.
  if (!$this->checksumProvider
    ->isValid($cache->checksum, $cache->tags)) {
    $cache->valid = FALSE;
  }
  return $cache->valid;
}