You are here

protected function RedisCacheTagsChecksum::getTagInvalidationCounts in Redis 8

Fetches invalidation counts for cache tags.

Parameters

string[] $tags: The list of tags to fetch invalidations for.

Return value

int[] List of invalidation counts keyed by the respective cache tag.

Overrides CacheTagsChecksumTrait::getTagInvalidationCounts

File

src/Cache/RedisCacheTagsChecksum.php, line 80

Class

RedisCacheTagsChecksum
Cache tags invalidations checksum implementation that uses redis.

Namespace

Drupal\redis\Cache

Code

protected function getTagInvalidationCounts(array $tags) {
  $keys = array_map([
    $this,
    'getTagKey',
  ], $tags);

  // The mget command returns the values as an array with numeric keys,
  // combine it with the tags array to get the expected return value and run
  // it through intval() to convert to integers and FALSE to 0.
  $values = $this->client
    ->mget($keys);
  return $values ? array_map('intval', array_combine($tags, $values)) : [];
}