https://github.com/arnaud-lb/phpketama
Pure-PHP implementation of libketama, a consistent hashing library
https://github.com/arnaud-lb/phpketama
Last synced: about 2 months ago
JSON representation
Pure-PHP implementation of libketama, a consistent hashing library
- Host: GitHub
- URL: https://github.com/arnaud-lb/phpketama
- Owner: arnaud-lb
- License: mit
- Created: 2017-10-26T12:25:22.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-07-10T10:06:06.000Z (almost 2 years ago)
- Last Synced: 2024-10-13T15:11:21.195Z (8 months ago)
- Language: PHP
- Homepage:
- Size: 27.3 KB
- Stars: 7
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PHP Ketama
This is a pure-PHP implementation of libketama, a consistent hashing library.
## Compatibility with libketama
PHP Ketama uses the same algorithm as libketama, and will always return the
same results as libketama.The API is not compatible.
## 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.## Usage
``` php
createContinuum('/some/file');// Lookup server
$ip = $continuum->getServer("some key");
```Continuum file:
```
# server weight
server1 1
server2 3
server3 1
server4 2
```