2017 © Pedro Peláez
 

library phpketama

image

alb/phpketama

  • Thursday, October 26, 2017
  • by arnaud-lb
  • Repository
  • 1 Watchers
  • 3 Stars
  • 2,111 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 62 % Grown

The README.md

PHP Ketama

This is a pure-PHP implementation of libketama, a consistent hashing library., (*1)

Compatibility with libketama

PHP Ketama uses the same algorithm as libketama, and will always return the same results as libketama., (*2)

The API is not compatible., (*3)

Speed

Loading a cached continuum file is faster in PHP Ketama. Hashing is slower. As per the included benchmark, this makes PHP Ketama faster than libketama when doing up to 200 hashes per instance., (*4)

Usage

``` php <?php, (*5)

use Ketama\Ketama; use Symfony\Component\Cache\Adapter\ApcuAdapter; use Symfony\Component\Cache\Psr16Cache;, (*6)

// Cache used to store the parsed continuum file $cache = new Psr16Cache(new ApcuAdapter('mynamespace'), (*7)

$ketama = new Ketama($cache); $continuum = $ketama->createContinuum('/some/file');, (*8)

// Lookup server $ip = $continuum->getServer("some key");, (*9)


Continuum file:

server weight

server1 1 server2 3 server3 1 server4 2 ```, (*10)

The Versions

26/10 2017

dev-master

9999999-dev

  Sources   Download

MIT

The Requires

 

The Development Requires

by Arnaud Le Blanc

26/10 2017

v0.2.0

0.2.0.0

  Sources   Download

MIT

The Requires

 

The Development Requires

by Arnaud Le Blanc

26/10 2017

v0.1.0

0.1.0.0

  Sources   Download

MIT

The Requires

 

The Development Requires

by Arnaud Le Blanc