Skip to content

Simple consistent hashing ring implemented in Go

Notifications You must be signed in to change notification settings

pabrodez/hashring

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hashring

Consistent hashing ring implementation. Useful for distributing cache among nodes.

How to use

import (
    "github.com/pabrodez/hashring"
)
// we are using a high replication factor as it ensures a lower standard deviation of the distribution of keys among nodes
nodeHashring := hashring.New([]string{"node1", "node2", "node3", 150})

nodeAddr := nodeHashring.GetNodeForKey("cacheKey")

nodeHashring.RemoveNode("node2")

nodeHashring.AddNode("node4")

References:

About

Simple consistent hashing ring implemented in Go

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages