Framework Update
This commit is contained in:
+14
-1
@@ -118,12 +118,25 @@ abstract class Connection
|
||||
$time = round((microtime(true) - $start) * 1000, 2);
|
||||
|
||||
if (isset($this->events)) {
|
||||
$this->event(new CommandExecuted($method, $parameters, $time, $this));
|
||||
$this->event(new CommandExecuted(
|
||||
$method, $this->parseParametersForEvent($parameters), $time, $this
|
||||
));
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the command's parameters for event dispatching.
|
||||
*
|
||||
* @param array $parameters
|
||||
* @return array
|
||||
*/
|
||||
protected function parseParametersForEvent(array $parameters)
|
||||
{
|
||||
return $parameters;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fire the given event if possible.
|
||||
*
|
||||
|
||||
@@ -105,7 +105,7 @@ class PhpRedisConnection extends Connection implements ConnectionContract
|
||||
* Get the value of the given hash fields.
|
||||
*
|
||||
* @param string $key
|
||||
* @param mixed $dictionary
|
||||
* @param mixed ...$dictionary
|
||||
* @return array
|
||||
*/
|
||||
public function hmget($key, ...$dictionary)
|
||||
@@ -121,7 +121,7 @@ class PhpRedisConnection extends Connection implements ConnectionContract
|
||||
* Set the given hash fields to their respective values.
|
||||
*
|
||||
* @param string $key
|
||||
* @param mixed $dictionary
|
||||
* @param mixed ...$dictionary
|
||||
* @return int
|
||||
*/
|
||||
public function hmset($key, ...$dictionary)
|
||||
@@ -166,7 +166,7 @@ class PhpRedisConnection extends Connection implements ConnectionContract
|
||||
/**
|
||||
* Removes and returns the first element of the list stored at key.
|
||||
*
|
||||
* @param mixed $arguments
|
||||
* @param mixed ...$arguments
|
||||
* @return array|null
|
||||
*/
|
||||
public function blpop(...$arguments)
|
||||
@@ -179,7 +179,7 @@ class PhpRedisConnection extends Connection implements ConnectionContract
|
||||
/**
|
||||
* Removes and returns the last element of the list stored at key.
|
||||
*
|
||||
* @param mixed $arguments
|
||||
* @param mixed ...$arguments
|
||||
* @return array|null
|
||||
*/
|
||||
public function brpop(...$arguments)
|
||||
@@ -205,7 +205,7 @@ class PhpRedisConnection extends Connection implements ConnectionContract
|
||||
* Add one or more members to a sorted set or update its score if it already exists.
|
||||
*
|
||||
* @param string $key
|
||||
* @param mixed $dictionary
|
||||
* @param mixed ...$dictionary
|
||||
* @return int
|
||||
*/
|
||||
public function zadd($key, ...$dictionary)
|
||||
@@ -426,7 +426,7 @@ class PhpRedisConnection extends Connection implements ConnectionContract
|
||||
*
|
||||
* @param string $script
|
||||
* @param int $numkeys
|
||||
* @param mixed $arguments
|
||||
* @param mixed ...$arguments
|
||||
* @return mixed
|
||||
*/
|
||||
public function evalsha($script, $numkeys, ...$arguments)
|
||||
@@ -441,7 +441,7 @@ class PhpRedisConnection extends Connection implements ConnectionContract
|
||||
*
|
||||
* @param string $script
|
||||
* @param int $numberOfKeys
|
||||
* @param dynamic $arguments
|
||||
* @param dynamic ...$arguments
|
||||
* @return mixed
|
||||
*/
|
||||
public function eval($script, $numberOfKeys, ...$arguments)
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace Illuminate\Redis\Connections;
|
||||
|
||||
use Predis\Command\Redis\FLUSHDB;
|
||||
use Predis\Command\ServerFlushDatabase;
|
||||
|
||||
class PredisClusterConnection extends PredisConnection
|
||||
@@ -13,8 +14,12 @@ class PredisClusterConnection extends PredisConnection
|
||||
*/
|
||||
public function flushdb()
|
||||
{
|
||||
$this->client->executeCommandOnNodes(
|
||||
tap(new ServerFlushDatabase)->setArguments(func_get_args())
|
||||
);
|
||||
$command = class_exists(ServerFlushDatabase::class)
|
||||
? ServerFlushDatabase::class
|
||||
: FLUSHDB::class;
|
||||
|
||||
foreach ($this->client as $node) {
|
||||
$node->executeCommand(tap(new $command)->setArguments(func_get_args()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ namespace Illuminate\Redis\Connections;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Contracts\Redis\Connection as ConnectionContract;
|
||||
use Predis\Command\Argument\ArrayableArgument;
|
||||
|
||||
/**
|
||||
* @mixin \Predis\Client
|
||||
@@ -50,4 +51,20 @@ class PredisConnection extends Connection implements ConnectionContract
|
||||
|
||||
unset($loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the command's parameters for event dispatching.
|
||||
*
|
||||
* @param array $parameters
|
||||
* @return array
|
||||
*/
|
||||
protected function parseParametersForEvent(array $parameters)
|
||||
{
|
||||
return collect($parameters)
|
||||
->transform(function ($parameter) {
|
||||
return $parameter instanceof ArrayableArgument
|
||||
? $parameter->toArray()
|
||||
: $parameter;
|
||||
})->all();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user