소스 검색

Minor change (mostly micro-optimization).

Daniele Alessandri 13 년 전
부모
커밋
69d4c013f7
2개의 변경된 파일6개의 추가작업 그리고 2개의 파일을 삭제
  1. 3 1
      lib/Predis/Cluster/PredisClusterHashStrategy.php
  2. 3 1
      lib/Predis/Cluster/RedisClusterHashStrategy.php

+ 3 - 1
lib/Predis/Cluster/PredisClusterHashStrategy.php

@@ -311,7 +311,9 @@ class PredisClusterHashStrategy implements CommandHashStrategyInterface
         $hash = $command->getHash();
 
         if (!isset($hash) && isset($this->commands[$cmdID = $command->getId()])) {
-            if ($key = call_user_func($this->commands[$cmdID], $command)) {
+            $key = call_user_func($this->commands[$cmdID], $command);
+
+            if (isset($key)) {
                 $hash = $this->getKeyHash($key);
                 $command->setHash($hash);
             }

+ 3 - 1
lib/Predis/Cluster/RedisClusterHashStrategy.php

@@ -263,7 +263,9 @@ class RedisClusterHashStrategy implements CommandHashStrategyInterface
         $hash = $command->getHash();
 
         if (!isset($hash) && isset($this->commands[$cmdID = $command->getId()])) {
-            if (null !== $key = call_user_func($this->commands[$cmdID], $command)) {
+            $key = call_user_func($this->commands[$cmdID], $command);
+
+            if (isset($key)) {
                 $hash = $this->hashGenerator->hash($key);
                 $command->setHash($hash);
             }