Browse Source

Fix example for custom distribution strategy.

See ISSUE #63 for details.
Daniele Alessandri 13 years ago
parent
commit
f4c58b926b
2 changed files with 11 additions and 2 deletions
  1. 9 0
      CHANGELOG.md
  2. 2 2
      examples/CustomDistributionStrategy.php

+ 9 - 0
CHANGELOG.md

@@ -1,3 +1,12 @@
+v0.7.3 (2012-xx-xx)
+===============================================================================
+
+- __FIX__: `examples\CustomDistributionStrategy.php` had a mistyped constructor
+  call and produced a bad distribution due to an error as pointed in ISSUE #63.
+  This bug is limited to the above mentioned example and does not affect the
+  classes implemented in the `Predis\Distribution` namespace.
+
+
 v0.7.2 (2012-04-01)
 ===============================================================================
 

+ 2 - 2
examples/CustomDistributionStrategy.php

@@ -23,7 +23,7 @@ class NaiveDistributionStrategy implements IDistributionStrategy
     private $nodes;
     private $nodesCount;
 
-    public function __constructor()
+    public function __construct()
     {
         $this->nodes = array();
         $this->nodesCount = 0;
@@ -51,7 +51,7 @@ class NaiveDistributionStrategy implements IDistributionStrategy
             throw new RuntimeException('No connections');
         }
 
-        return $this->nodes[$count > 1 ? abs(crc32($key) % $count) : 0];
+        return $this->nodes[$count > 1 ? abs($key % $count) : 0];
     }
 
     public function generateKey($value)