Predis supports two methods for passing multiple keys (or keys with values) for Redis command variables. The first one basically matches the same command signature as in the Redis documentation , so using HMSET and HMGET as examples:
$redis->hmset("hash", "field:1", "value:1", "field:2", "value:2");
$values = $redis->hmget("hash", "field:1", "field:2");
but you can also pass a list of keys and / or values as one argument to an array:
$redis->hmset("hash", array("field:1" => "value:1", "field:2" => "value:2"));
$values = $redis->hmget("hash", array("field:1", "field:2"));
Choosing which one to use is actually a matter of preference.
source
share