memcached

package
v0.0.0-...-c42b1bb Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2018 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultExpiry = time.Hour
)

Variables

This section is empty.

Functions

This section is empty.

Types

type MemcacheClient

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

MemcacheClient is a memcache client that gets its server list from SRV records, and periodically updates that ServerList.

func NewFixedServerMemcacheClient

func NewFixedServerMemcacheClient(config MemcacheConfig, addresses ...string) *MemcacheClient

Does not use DNS, accepts static list of servers.

func NewMemcacheClient

func NewMemcacheClient(config MemcacheConfig) *MemcacheClient

func (*MemcacheClient) GetKey

func (c *MemcacheClient) GetKey(k cache.Keyer) ([]byte, time.Time, error)

GetKey gets the value and its expiry time from the cache.

func (*MemcacheClient) SetKey

func (c *MemcacheClient) SetKey(k cache.Keyer, v []byte) error

SetKey sets the value at a key.

func (*MemcacheClient) Stop

func (c *MemcacheClient) Stop()

Stop the memcache client.

type MemcacheConfig

type MemcacheConfig struct {
	Host           string
	Service        string
	Expiry         time.Duration
	Timeout        time.Duration
	UpdateInterval time.Duration
	Logger         log.Logger
	MaxIdleConns   int
}

MemcacheConfig defines how a MemcacheClient should be constructed.

Jump to

Keyboard shortcuts

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