PHP code example of alb / phpketama

1. Go to this page and download the library: Download alb/phpketama library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

alb / phpketama example snippets

 php


use Ketama\Ketama;
use Symfony\Component\Cache\Adapter\ApcuAdapter;
use Symfony\Component\Cache\Psr16Cache;

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

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

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