-
Notifications
You must be signed in to change notification settings - Fork 2
"C" only implementation of ketama lib (https://github.com/RJ/ketama) using api for adding server instead of file (remove_server will be added in the future).
License
bisegni/libketama-c
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
"c" only implementation of ketama lib (https://github.com/RJ/ketama) using api for adding server instead of file. The repository now has only an xcode project, in future will be added more compilaiton types. Anyway the files libketama/ketama.c and libketama/md5.c compile also on linux and probably on window. Only ketama.c has been update to expose new api and structure. "C" Example: ```c++ ketama_t ktma; ketama_init(&ktma); ketama_add_server(&ktma, "192.168.1.1:11211", 60); ketama_add_server(&ktma, "192.168.1.2:11211", 30); ketama_add_server(&ktma, "192.168.1.3:11211", 10); ketama_update_continuum(&ktma); ketama_print_continuum(&ktma); int i; for ( i = 0; i < 1000000; i++ ) { char k[10]; sprintf( k, "%d", i ); unsigned int kh = ketama_hashi( k ); mcs* m = ketama_get_server(&ktma, k); printf( "hash:%u Continuum point:%u Host:%s\n", kh, m->point, m->ip ); } ketama_destroy(&ktma); ```
About
"C" only implementation of ketama lib (https://github.com/RJ/ketama) using api for adding server instead of file (remove_server will be added in the future).
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published