瀏覽代碼

Fix example for custom distribution strategy.

See ISSUE #63 for details.
Daniele Alessandri 13 年之前
父節點
當前提交
9426d78b90
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      examples/CustomDistributionStrategy.php

+ 2 - 2
examples/CustomDistributionStrategy.php

@@ -23,7 +23,7 @@ class NaiveDistributionStrategy implements DistributionStrategyInterface
     private $nodes;
     private $nodesCount;
 
-    public function __constructor()
+    public function __construct()
     {
         $this->nodes = array();
         $this->nodesCount = 0;
@@ -51,7 +51,7 @@ class NaiveDistributionStrategy implements DistributionStrategyInterface
             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 hash($value)