protected function CacheBase::createEntryHash in Redis 8
Create cache entry.
Parameters
string $cid:
mixed $data:
int $expire:
string[] $tags:
Return value
array
2 calls to CacheBase::createEntryHash()
- PhpRedis::set in src/Cache/ PhpRedis.php 
- Stores data in the persistent cache.
- Predis::set in src/Cache/ Predis.php 
- Stores data in the persistent cache.
File
- src/Cache/ CacheBase.php, line 360 
Class
- CacheBase
- Base class for redis cache backends.
Namespace
Drupal\redis\CacheCode
protected function createEntryHash($cid, $data, $expire, array $tags) {
  // Always add a cache tag for the current bin, so that we can use that for
  // invalidateAll().
  $tags[] = $this
    ->getTagForBin();
  assert(Inspector::assertAllStrings($tags), 'Cache Tags must be strings.');
  $hash = [
    'cid' => $cid,
    'created' => round(microtime(TRUE), 3),
    'expire' => $expire,
    'tags' => implode(' ', $tags),
    'valid' => 1,
    'checksum' => $this->checksumProvider
      ->getCurrentChecksum($tags),
  ];
  // Let Redis handle the data types itself.
  if (!is_string($data)) {
    $hash['data'] = $this->serializer
      ->encode($data);
    $hash['serialized'] = 1;
  }
  else {
    $hash['data'] = $data;
    $hash['serialized'] = 0;
  }
  if (Settings::get('redis_compress_length', 0) && strlen($hash['data']) > Settings::get('redis_compress_length', 0)) {
    $hash['data'] = @gzcompress($hash['data'], Settings::get('redis_compress_level', 1));
    $hash['gz'] = TRUE;
  }
  return $hash;
}