memcached

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2024 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewClient

func NewClient(cfg Config) (*memcache.Client, error)

NewClient creates a new *memcache.Client using consistent hashing for server selection and configured by Config

Types

type Client

type Client interface {
	Get(key string) (item *memcache.Item, err error)
	Add(item *memcache.Item) error
	Set(item *memcache.Item) error
	CompareAndSwap(item *memcache.Item) error
	Delete(key string) error
}

Client is an interface abstraction for *memcache.Client that has a mock

func NewMeasuredClient

func NewMeasuredClient(client Client, recorder Recorder, timeNow func() time.Time) Client

type Config

type Config struct {
	Timeout      time.Duration       `yaml:"timeout"`
	MaxIdleConns int                 `yaml:"max_idle_conns"`
	Servers      flagext.StringSlice `yaml:"servers"`
}

func (*Config) RegisterFlags

func (c *Config) RegisterFlags(flags *flag.FlagSet)

func (*Config) RegisterFlagsWithPrefix

func (c *Config) RegisterFlagsWithPrefix(prefix string, flags *flag.FlagSet)

RegisterFlagsWithPrefix registers flags, adding the provided prefix if needed. If the prefix is not blank and doesn't end with '.', a '.' is appended to it.

type MeasuredClient

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

func (*MeasuredClient) Add

func (mc *MeasuredClient) Add(item *memcache.Item) (err error)

func (*MeasuredClient) CompareAndSwap

func (mc *MeasuredClient) CompareAndSwap(item *memcache.Item) (err error)

func (*MeasuredClient) Delete

func (mc *MeasuredClient) Delete(key string) (err error)

func (*MeasuredClient) Get

func (mc *MeasuredClient) Get(key string) (item *memcache.Item, err error)

func (*MeasuredClient) Set

func (mc *MeasuredClient) Set(item *memcache.Item) (err error)

type Recorder

type Recorder interface {
	// contains filtered or unexported methods
}

func NewRecorder

func NewRecorder(reg prometheus.Registerer) Recorder

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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