Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
A Consistent Hashing implementation for Ruby
branch: master

README.rdoc

ConsistentHashr

A small module to do easy consistent hashing.

Usage

ConsistentHashr.add_server(“s1”, “server1”) ConsistentHashr.add_server(“s2”, “server2”) ConsistentHashr.add_server(“s3”, “server3”) ConsistentHashr.add_server(“s4”, “server4”) ConsistentHashr.add_server(“s5”, “server5”)

ConsistentHashr.get(key) # Should return the same key consistently when new servers are added.

Implementation

Based on “Mike Perham's”:www.mikeperham.com/ “code”:www.mikeperham.com/2009/01/14/consistent-hashing-in-memcache-client/ and tests. I thought this layer didn't belong to any specific client, this is why I extracted it.

Greatly inspired by “Tom White's consistent hashing explaination”:weblogs.java.net/blog/tomwhite/archive/2007/11/consistent_hash.html.

Something went wrong with that request. Please try again.