You are here

public function CacheBase::invalidateMultiple in Redis 8

Marks cache items as invalid.

Invalid items may be returned in later calls to get(), if the $allow_invalid argument is TRUE.

Parameters

string[] $cids: An array of cache IDs to invalidate.

Overrides CacheBackendInterface::invalidateMultiple

See also

\Drupal\Core\Cache\CacheBackendInterface::deleteMultiple()

\Drupal\Core\Cache\CacheBackendInterface::invalidate()

\Drupal\Core\Cache\CacheBackendInterface::invalidateAll()

1 call to CacheBase::invalidateMultiple()
CacheBase::invalidate in src/Cache/CacheBase.php
Marks a cache item as invalid.

File

src/Cache/CacheBase.php, line 394

Class

CacheBase
Base class for redis cache backends.

Namespace

Drupal\redis\Cache

Code

public function invalidateMultiple(array $cids) {

  // Loop over all cache items, they are stored as a hash, so we can access
  // the valid flag directly, only write if it exists and is not 0.
  foreach ($cids as $cid) {
    $key = $this
      ->getKey($cid);
    if ($this->client
      ->hGet($key, 'valid')) {
      $this->client
        ->hSet($key, 'valid', 0);
    }
  }
}