memcached

package
v2.2.1 Latest Latest
Warning

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

Go to latest
Published: May 13, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const PluginName = "memcached"

Variables

View Source
var EmptyItem = kv.Item{}

Functions

func NewMemcachedDriver

func NewMemcachedDriver(log logger.Logger, key string, cfgPlugin config.Configurer) (kv.Storage, error)

NewMemcachedDriver returns a memcache client using the provided server(s) with equal weight. If a server is listed multiple times, it gets a proportional amount of weight.

Types

type Config

type Config struct {
	// Addr is url for memcached, 11211 port is used by default
	Addr []string
}

func (*Config) InitDefaults

func (s *Config) InitDefaults()

type Driver

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

func (*Driver) Delete

func (d *Driver) Delete(keys ...string) error

func (*Driver) Get

func (d *Driver) Get(key string) ([]byte, error)

Get gets the item for the given key. ErrCacheMiss is returned for a memcache cache miss. The key must be at most 250 bytes in length.

func (*Driver) Has

func (d *Driver) Has(keys ...string) (map[string]bool, error)

Has checks the key for existence

func (*Driver) MExpire

func (d *Driver) MExpire(items ...kv.Item) error

MExpire Expiration is the cache expiration time, in seconds: either a relative time from now (up to 1 month), or an absolute Unix epoch time. Zero means the Item has no expiration time.

func (*Driver) MGet

func (d *Driver) MGet(keys ...string) (map[string]interface{}, error)

MGet return map with key -- string and map value as value -- []byte

func (*Driver) Set

func (d *Driver) Set(items ...kv.Item) error

Set sets the KV pairs. Keys should be 250 bytes maximum TTL: Expiration is the cache expiration time, in seconds: either a relative time from now (up to 1 month), or an absolute Unix epoch time. Zero means the Item has no expiration time.

func (*Driver) TTL

func (d *Driver) TTL(_ ...string) (map[string]interface{}, error)

TTL return time in seconds (int32) for a given keys

type Plugin

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

func (*Plugin) Available added in v2.2.0

func (s *Plugin) Available()

Available interface implementation

func (*Plugin) Init

func (s *Plugin) Init(log logger.Logger, cfg config.Configurer) error

func (*Plugin) Name

func (s *Plugin) Name() string

Name returns plugin user-friendly name

func (*Plugin) Provide

func (s *Plugin) Provide(key string) (kv.Storage, error)

Jump to

Keyboard shortcuts

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