gojavahash

package
v2.3.1+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 27, 2019 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package gojavahash implements a ServerSelector for gomemcache that provides hashing that's compatible with SpyMemcached's native (e.g. java) hashing. This is based very closely on the excellent https://github.com/thatguystone/gomcketama

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(server ...string) (*mc.Client, error)

New creates a new memcache client with the given servers, using ketama as the ServerSelector. This functions exactly like gomemcache's New().

Types

type JavaServerSelector

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

JavaServerSelector implements gomemcache's ServerSelector using java hash equiv

func (*JavaServerSelector) AddServer

func (ks *JavaServerSelector) AddServer(server string) error

AddServer adds a server to the ketama continuum.

func (*JavaServerSelector) Each

func (ks *JavaServerSelector) Each(f func(net.Addr) error) error

Each loops through all registered servers, calling the given function.

func (*JavaServerSelector) PickServer

func (ks *JavaServerSelector) PickServer(key string) (net.Addr, error)

PickServer returns the server address that a given item should be written to.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL