Skip to content
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
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]);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PhpRedis doesn't support the $count parameter.

}

/**
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);
Copy link
Contributor Author

@tillkruss tillkruss Jan 28, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added missing $key parameter and inverted $score and $member.

}

/**
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
]);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replaced $parameter with $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);
}
}