memcached

package
v2.0.0-beta.24 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 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 NewMemcachedClient

func NewMemcachedClient(url string) kv.Storage

NewMemcachedClient 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 Plugin

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

func (*Plugin) Close

func (s *Plugin) Close() error

func (*Plugin) Delete

func (s *Plugin) Delete(keys ...string) error

func (*Plugin) Get

func (s *Plugin) 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 (*Plugin) Has

func (s *Plugin) Has(keys ...string) (map[string]bool, error)

Has checks the key for existence

func (*Plugin) Init

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

func (*Plugin) MExpire

func (s *Plugin) MExpire(items ...kv.Item) error

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 (*Plugin) MGet

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

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

func (*Plugin) Name

func (s *Plugin) Name() string

Name returns plugin user-friendly name

func (*Plugin) RPC

func (s *Plugin) RPC() interface{}

RPCService returns associated rpc service.

func (*Plugin) Serve

func (s *Plugin) Serve() chan error

func (*Plugin) Set

func (s *Plugin) 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 (*Plugin) Stop

func (s *Plugin) Stop() error

Memcached has no stop/close or smt similar to close the connection

func (*Plugin) TTL

func (s *Plugin) TTL(keys ...string) (map[string]interface{}, error)

return time in seconds (int32) for a given keys

Jump to

Keyboard shortcuts

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