Reorganize some Redis commands classes.

This commit is contained in:
Daniele Alessandri
2011-04-25 12:39:21 +02:00
parent 86edc50ac4
commit b2575bd667
68 changed files with 248 additions and 259 deletions
+31
View File
@@ -0,0 +1,31 @@
<?php
namespace Predis\Commands;
class StringSetMultiple extends Command {
public function getId() {
return 'MSET';
}
public function filterArguments(Array $arguments) {
if (count($arguments) === 1 && is_array($arguments[0])) {
$flattenedKVs = array();
$args = $arguments[0];
foreach ($args as $k => $v) {
$flattenedKVs[] = $k;
$flattenedKVs[] = $v;
}
return $flattenedKVs;
}
return $arguments;
}
protected function canBeHashed() {
$args = $this->getArguments();
$keys = array();
for ($i = 0; $i < count($args); $i += 2) {
$keys[] = $args[$i];
}
return $this->checkSameHashForKeys($keys);
}
}