Browse Source

Rename helper method used to fetch the key tag from a key.

The name "getKeyHashablePart" was too generic for this method after all.
Daniele Alessandri 13 years ago
parent
commit
b7c715a03f
3 changed files with 5 additions and 5 deletions
  1. 3 3
      lib/Predis/Commands/Command.php
  2. 1 1
      lib/Predis/Helpers.php
  3. 1 1
      lib/Predis/Network/PredisCluster.php

+ 3 - 3
lib/Predis/Commands/Command.php

@@ -123,10 +123,10 @@ abstract class Command implements ICommand
             return false;
         }
 
-        $currentKey = Helpers::getKeyHashablePart($keys[0]);
+        $currentKey = Helpers::extractKeyTag($keys[0]);
 
         for ($i = 1; $i < $count; $i++) {
-            $nextKey = Helpers::getKeyHashablePart($keys[$i]);
+            $nextKey = Helpers::extractKeyTag($keys[$i]);
             if ($currentKey !== $nextKey) {
                 return false;
             }
@@ -146,7 +146,7 @@ abstract class Command implements ICommand
         }
 
         if ($this->canBeHashed()) {
-            $key = Helpers::getKeyHashablePart($this->arguments[0]);
+            $key = Helpers::extractKeyTag($this->arguments[0]);
             $this->hash = $distributor->generateKey($key);
 
             return $this->hash;

+ 1 - 1
lib/Predis/Helpers.php

@@ -87,7 +87,7 @@ class Helpers
      * @param string $key A key.
      * @return string
      */
-    public static function getKeyHashablePart($key)
+    public static function extractKeyTag($key)
     {
         $start = strpos($key, '{');
         if ($start !== false) {

+ 1 - 1
lib/Predis/Network/PredisCluster.php

@@ -123,7 +123,7 @@ class PredisCluster implements IConnectionCluster, \IteratorAggregate
      */
     public function getConnectionByKey($key)
     {
-        $hashablePart = Helpers::getKeyHashablePart($key);
+        $hashablePart = Helpers::extractKeyTag($key);
         $keyHash = $this->distributor->generateKey($hashablePart);
 
         return $this->distributor->get($keyHash);