Skip to main content

ketama consistent hashing in cython

Project description


pyketama is a cython implementation of ketama consistent hashing algorithm.


pip install pyketama


import ketama

data = ["", ""]
continuum = ketama.Continuum(data)

# with weight, (key, weith)
data = [("", 400), ("", 500)]
continuum = ketama.Continuum(data)

# with value, (key, value, weight)
data = [("node1", "", 400), ("node2", "", 500)]
continuum = ketama.Continuum(data)

# set item like dict
continuum = ketama.Continuum()
continuum['tom'] = 123
continuum['jerry'] = "hello world"

# with weight (key, weight)
continuum = ketama.Continuum()
continuum[('tom', 100)] = 123
continuum[('jerry', 300)] = "hello world"

Project details

Download files

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

Files for pyketama, version 0.2.0
Filename, size File type Python version Upload date Hashes
Filename, size pyketama-0.2.0.tar.gz (36.3 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page