Rediska

Follow me on twitter…

Key distributor

Algorithm for distributing keys among two or more redis servers.

At the moment Rediska supports following modes:

  • crc32 - simple and fast algorythm crc32($keyName) % serversCount.
  • consistentHashing - advanced algorithm of distributing keys by servers.
<?php

require_once 'Rediska.php'; 
$options = array( 
    'keyDistributor' => 'crc32',
);
$rediska = new Rediska($options);

?>

By default Rediska uses consistentHashing.

Custom algorithm

You can use your own key distribution algorithm - just create a class implementing Rediska_KeyDistributor_Interface interface.

<?php

require_once 'Rediska.php';
$options = array( 
    'keyDistributor' => 'YouPersonalClass',
);
$rediska = new Rediska($options);

?>

Comments

Fork me on GitHub