public function set($entryIdentifier, $data, array $tags = [], $lifetime = null)
{
if ($this->isFrozen()) {
throw new \RuntimeException(sprintf('Cannot add or modify cache entry because the backend of cache "%s" is frozen.', $this->cacheIdentifier), 1323344192);
}
if ($lifetime === null) {
$lifetime = $this->defaultLifetime;
}
$setOptions = [];
if ($lifetime > 0) {
$setOptions['ex'] = $lifetime;
}
$this->redis->multi();
$result = $this->redis->set($this->buildKey('entry:' . $entryIdentifier), $this->compress($data), $setOptions);
if (!$result instanceof \Redis) {
$this->verifyRedisVersionIsSupported();
}
$this->redis->lRem($this->buildKey('entries'), $entryIdentifier, 0);
$this->redis->rPush($this->buildKey('entries'), $entryIdentifier);
foreach ($tags as $tag) {
$this->redis->sAdd($this->buildKey('tag:' . $tag), $entryIdentifier);
$this->redis->sAdd($this->buildKey('tags:' . $entryIdentifier), $tag);
}
$this->redis->exec();
}