Skip to main content

Python bindings for Ketama consistent hash library

Project description

Python bindings for Ketama consistent hash library.

Example

from ketama import Ketama

with open("ketama.conf", "w") as fp:
    fp.write("127.0.0.1:1\t400\n")
    fp.write("127.0.0.1:2\t600\n")
    fp.write("127.0.0.1:3\t600\n")


def main():
    k = Ketama("ketama.conf")


    key_hash, server = k.get_server("1")
    assert server == "127.0.0.1:3"

    key_hash, server = k.get_server("3")
    assert server != "127.0.0.1:1"


if __name__ == '__main__':
    main()

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ketama-0.1.1.tar.gz (15.6 kB view hashes)

Uploaded Source

Built Distributions

ketama-0.1.1-cp310-cp310-macosx_10_9_universal2.whl (43.2 kB view hashes)

Uploaded CPython 3.10 macOS 10.9+ universal2 (ARM64, x86-64)

ketama-0.1.1-cp39-cp39-macosx_10_9_universal2.whl (22.8 kB view hashes)

Uploaded CPython 3.9 macOS 10.9+ universal2 (ARM64, x86-64)

ketama-0.1.1-cp38-cp38m-manylinux1_x86_64.whl (36.0 kB view hashes)

Uploaded CPython 3.8m

ketama-0.1.1-cp38-cp38-macosx_11_0_universal2.whl (22.9 kB view hashes)

Uploaded CPython 3.8 macOS 11.0+ universal2 (ARM64, x86-64)

ketama-0.1.1-cp38-cp38-macosx_10_9_x86_64.whl (12.5 kB view hashes)

Uploaded CPython 3.8 macOS 10.9+ x86-64

ketama-0.1.1-cp37-cp37m-manylinux1_x86_64.whl (35.5 kB view hashes)

Uploaded CPython 3.7m

ketama-0.1.1-cp37-cp37m-macosx_10_9_x86_64.whl (12.5 kB view hashes)

Uploaded CPython 3.7m macOS 10.9+ x86-64

ketama-0.1.1-cp36-cp36m-manylinux1_x86_64.whl (35.5 kB view hashes)

Uploaded CPython 3.6m

ketama-0.1.1-cp36-cp36m-macosx_10_9_x86_64.whl (12.5 kB view hashes)

Uploaded CPython 3.6m macOS 10.9+ x86-64

ketama-0.1.1-cp35-cp35m-manylinux1_x86_64.whl (35.5 kB view hashes)

Uploaded CPython 3.5m

ketama-0.1.1-cp35-cp35m-macosx_10_6_intel.whl (20.6 kB view hashes)

Uploaded CPython 3.5m macOS 10.6+ intel

ketama-0.1.1-cp34-cp34m-manylinux1_x86_64.whl (35.3 kB view hashes)

Uploaded CPython 3.4m

ketama-0.1.1-cp34-cp34m-macosx_10_6_intel.whl (20.5 kB view hashes)

Uploaded CPython 3.4m macOS 10.6+ intel

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page