Skip to content

Commit

Permalink
Fix PhpRedis (#17627)
Browse files Browse the repository at this point in the history
  • Loading branch information
tillkruss authored and taylorotwell committed Jan 28, 2017
1 parent 8a1737e commit ddcf575
Showing 1 changed file with 9 additions and 19 deletions.
28 changes: 9 additions & 19 deletions src/Illuminate/Redis/Connections/PhpRedisConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,11 @@ public function __construct($client)
*/
public function set($key, $value, $expireResolution = null, $expireTTL = null, $flag = null)
{
return $this->command(
'set',
return $this->command('set', [
$key,
$value,
$expireResolution ? [$expireResolution, $flag => $expireTTL] : null
);
]);
}

/**
Expand All @@ -47,7 +46,7 @@ public function set($key, $value, $expireResolution = null, $expireTTL = null, $
*/
public function lrem($key, $count, $value)
{
return $this->command('lrem', $key, $value, $count);
return $this->command('lrem', [$key, $value, $count]);
}

/**
Expand All @@ -59,7 +58,7 @@ public function lrem($key, $count, $value)
*/
public function spop($key, $count = null)
{
return $this->command('spop', $key, $count);
return $this->command('spop', [$key]);
}

/**
Expand All @@ -73,12 +72,12 @@ public function zadd($key, array $membersAndScoresDictionary)
{
$arguments = [];

foreach ($membersAndScoresDictionary as $member => $score) {
foreach ($membersAndScoresDictionary as $score => $member) {
$arguments[] = $score;
$arguments[] = $member;
}

return $this->command('zadd', ...$arguments);
return $this->client->zadd($key, ...$arguments);
}

/**
Expand All @@ -91,7 +90,9 @@ public function zadd($key, array $membersAndScoresDictionary)
*/
public function evalsha($script, $numkeys, ...$arguments)
{
return $this->command('evalsha', [$this->script('load', $script), $arguments, $parameters]);
return $this->command('evalsha', [
$this->script('load', $script), $arguments, $numkeys
]);
}

/**
Expand Down Expand Up @@ -163,17 +164,6 @@ public function __call($method, $parameters)
return $this->proxyToEval($parameters);
}

$arrayMethods = [
'hdel', 'hstrlen',
'lpush', 'rpush',
'scan', 'hscan', 'sscan', 'zscan',
'sadd', 'srem', 'sdiff', 'sinter', 'sunion', 'sdiffstore', 'sinterstore', 'sunionstore',
];

if (is_array($parameters) && in_array($method, $arrayMethods)) {
$this->command($method, ...$parameters);
}

return parent::__call($method, $parameters);
}
}

0 comments on commit ddcf575

Please sign in to comment.