소스 검색

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)