redis: github.com/go-redis/redis/internal/consistenthash Index | Files

package consistenthash

import "github.com/go-redis/redis/internal/consistenthash"

Package consistenthash provides an implementation of a ring hash.

Index

Package Files

consistenthash.go

type Hash Uses

type Hash func(data []byte) uint32

type Map Uses

type Map struct {
    // contains filtered or unexported fields
}

func New Uses

func New(replicas int, fn Hash) *Map

func (*Map) Add Uses

func (m *Map) Add(keys ...string)

Adds some keys to the hash.

func (*Map) Get Uses

func (m *Map) Get(key string) string

Gets the closest item in the hash to the provided key.

func (*Map) IsEmpty Uses

func (m *Map) IsEmpty() bool

Returns true if there are no items available.

Package consistenthash imports 3 packages (graph) and is imported by 12 packages. Updated 2019-04-26. Refresh now. Tools for package owners.