Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lrem changed parameter order #9

Merged
merged 2 commits into from
Sep 5, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions Classes/RedisBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ public function __construct(EnvironmentConfiguration $environmentConfiguration,
* @param string $data The data to be stored
* @param array $tags Tags to associate with this cache entry. If the backend does not support tags, this option can be ignored.
* @param integer $lifetime Lifetime of this cache entry in seconds. If NULL is specified, the default lifetime is used. "0" means unlimited lifetime.
* @throws RuntimeException
* @return void
* @throws RuntimeException
* @api
*/
public function set(string $entryIdentifier, string $data, array $tags = [], int $lifetime = null): void
Expand All @@ -116,13 +116,13 @@ public function set(string $entryIdentifier, string $data, array $tags = [], int

$this->client->multi();
$lifetime = $lifetime ?? $this->defaultLifetime;
if ($lifetime >0) {
if ($lifetime > 0) {
$status = $this->client->set($this->getPrefixedIdentifier('entry:' . $entryIdentifier), $this->compress($data), 'ex', $lifetime);
} else {
$status = $this->client->set($this->getPrefixedIdentifier('entry:' . $entryIdentifier), $this->compress($data));
}

$this->client->lRem($this->getPrefixedIdentifier('entries'), $entryIdentifier, 0);
$this->client->lRem($this->getPrefixedIdentifier('entries'), 0, $entryIdentifier);
$this->client->rPush($this->getPrefixedIdentifier('entries'), [$entryIdentifier]);

foreach ($tags as $tag) {
Expand Down Expand Up @@ -162,8 +162,8 @@ public function has(string $entryIdentifier): bool
* old entries for the identifier still exist, they are removed as well.
*
* @param string $entryIdentifier Specifies the cache entry to remove
* @throws RuntimeException
* @return boolean true if (at least) an entry could be removed or false if no entry was found
* @throws RuntimeException
* @api
*/
public function remove(string $entryIdentifier): bool
Expand All @@ -181,7 +181,7 @@ public function remove(string $entryIdentifier): bool
$this->client->sRem($this->getPrefixedIdentifier('tag:' . $tag), $entryIdentifier);
}
$this->client->del([$this->getPrefixedIdentifier('tags:' . $entryIdentifier)]);
$this->client->lRem($this->getPrefixedIdentifier('entries'), $entryIdentifier, 0);
$this->client->lRem($this->getPrefixedIdentifier('entries'), 0, $entryIdentifier);
/** @var array|bool $result */
$result = $this->client->exec();
} while ($result === false);
Expand All @@ -195,8 +195,8 @@ public function remove(string $entryIdentifier): bool
* The flush method will use the EVAL command to flush all entries and tags for this cache
* in an atomic way.
*
* @throws RuntimeException
* @return void
* @throws RuntimeException
* @api
*/
public function flush(): void
Expand Down Expand Up @@ -232,8 +232,8 @@ public function collectGarbage(): void
* Removes all cache entries of this cache which are tagged by the specified tag.
*
* @param string $tag The tag the entries must have
* @throws RuntimeException
* @return integer The number of entries which have been affected by this flush
* @throws RuntimeException
* @api
*/
public function flushByTag(string $tag): int
Expand Down Expand Up @@ -337,8 +337,8 @@ public function rewind()
*
* A frozen backend can only be thawn by calling the flush() method.
*
* @throws RuntimeException
* @return void
* @throws RuntimeException
*/
public function freeze(): void
{
Expand Down Expand Up @@ -409,7 +409,7 @@ public function setSentinels($sentinels): void
{
if (is_string($sentinels)) {
$this->sentinels = explode(',', $sentinels);
} elseif(is_array($sentinels)) {
} elseif (is_array($sentinels)) {
$this->sentinels = $sentinels;
} else {
throw new \InvalidArgumentException(sprintf('setSentinels(): Invalid type %s, string or array expected', gettype($sentinels)), 1575384806);
Expand Down Expand Up @@ -471,7 +471,7 @@ private function decompress($value)
if (empty($value)) {
return false;
}
return $this->useCompression() ? gzdecode((string) $value) : $value;
return $this->useCompression() ? gzdecode((string)$value) : $value;
}

/**
Expand Down