<?xml version="1.0" encoding="UTF-8"?>
<document>
  <body>&lt;p&gt;Algorithm for distributing keys among two or more redis servers.&lt;/p&gt; 
&lt;p&gt;At the moment Rediska supports following modes:&lt;/p&gt; 
&lt;ul&gt; 
&lt;li&gt;&lt;span class=&quot;pre&quot;&gt;crc32&lt;/span&gt; - simple and fast algorythm &lt;span class=&quot;pre&quot;&gt;crc32($keyName) % serversCount&lt;/span&gt;.&lt;/li&gt; 
&lt;li&gt;&lt;span class=&quot;pre&quot;&gt;consistentHashing&lt;/span&gt; - &lt;a href=&quot;http://weblogs.java.net/blog/tomwhite/archive/2007/11/consistent_hash.html&quot;&gt;advanced algorithm&lt;/a&gt; of distributing keys by servers.&lt;/li&gt; 
&lt;/ul&gt;
&lt;code&gt;
require_once 'Rediska.php'; 
$options = array( 
    'keyDistributor' =&gt; 'crc32',
);
$rediska = new Rediska($options);
&lt;/code&gt;
&lt;p&gt;By default Rediska uses &lt;span class=&quot;pre&quot;&gt;consistentHashing&lt;/span&gt;.&lt;/p&gt;
&lt;h3&gt;Custom algorithm&lt;/h3&gt;
&lt;p&gt;You can use your own key distribution algorithm - just create a class implementing &lt;span class=&quot;pre&quot;&gt;Rediska_KeyDistributor_Interface&lt;/span&gt; interface.&lt;/p&gt;
&lt;code&gt;
require_once 'Rediska.php';
$options = array( 
    'keyDistributor' =&gt; 'YouPersonalClass',
);
$rediska = new Rediska($options);
&lt;/code&gt;</body>
  <cached-slug>key-distributor</cached-slug>
  <comments-count type="integer">0</comments-count>
  <created-at type="datetime">2010-01-21T19:51:39Z</created-at>
  <id type="integer">7</id>
  <lft type="integer">11</lft>
  <parent-id type="integer">4</parent-id>
  <rgt type="integer">12</rgt>
  <title>Key distributor</title>
  <updated-at type="datetime">2010-01-22T10:00:42Z</updated-at>
  <user-id type="integer">1</user-id>
</document>
