1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-10-21 00:26:10 +02:00

Switch back to using rpush

Switches back to rpush to keep list order consistent with non capped
collections
This commit is contained in:
Matt Wells
2015-07-13 19:40:51 +01:00
parent ae2b2d0de1
commit 12711d133a
2 changed files with 8 additions and 8 deletions

View File

@@ -75,15 +75,15 @@ class RedisHandler extends AbstractProcessingHandler
{
if($this->redisClient instanceof \Redis) {
$this->redisClient->multi()
->lpush($this->redisKey, $record["formatted"])
->ltrim($this->redisKey, 0, $this->capSize)
->rpush($this->redisKey, $record["formatted"])
->ltrim($this->redisKey, -$this->capSize, -1)
->execute();
} else {
$redisKey = $this->redisKey;
$capSize = $this->capSize;
$this->redisClient->transaction(function($tx) use($record, $redisKey, $capSize) {
$tx->lpush($redisKey, $record["formatted"]);
$tx->ltrim($redisKey, 0, $capSize);
$tx->rpush($redisKey, $record["formatted"]);
$tx->ltrim($redisKey, -$capSize, -1);
});
}
}