memcachechk

package
v2.1.4 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MemcachedDefaultSetValue will be used if the "Set" check method is enabled
	// and "MemcachedSetOptions.Value" is _not_ set.
	MemcachedDefaultSetValue = "go-health/memcached-check"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Memcached

type Memcached struct {
	Config *MemcachedConfig
	// contains filtered or unexported fields
}

func NewMemcached

func NewMemcached(cfg *MemcachedConfig) (*Memcached, error)

func (*Memcached) Status

func (mc *Memcached) Status() (interface{}, error)

type MemcachedClient

type MemcachedClient interface {
	Get(key string) (item *memcache.Item, err error)
	Set(item *memcache.Item) error
}

type MemcachedClientWrapper

type MemcachedClientWrapper struct {
	MemcachedClient
}

Used to simplify testing routines

func (MemcachedClientWrapper) GetClient

func (mcw MemcachedClientWrapper) GetClient() MemcachedClient

type MemcachedConfig

type MemcachedConfig struct {
	Url     string
	Timeout int32
	Ping    bool
	Set     *MemcachedSetOptions
	Get     *MemcachedGetOptions
}

MongoConfig is used for configuring the go-mongo check.

"Url" is _required_; memcached connection url, format is "10.0.0.1:11011". Port (:11011) is mandatory "Timeout" defines timeout for socket write/read (useful for servers hosted on different machine) "Ping" is optional; Ping establishes tcp connection to memcached server.

type MemcachedGetOptions

type MemcachedGetOptions struct {
	Key               string
	Expect            []byte
	NoErrorMissingKey bool
}

MemcachedGetOptions contains attributes that can alter the behavior of the memcached "GET" check.

"Key" is _required_; the name of the key that we are attempting to "GET".

"Expect" is optional; optionally verify that the value for the key matches the Expect value.

"NoErrorMissingKey" is optional; by default, the "GET" check will error if the key we are fetching does not exist; flip this bool if that is normal/expected/ok.

type MemcachedSetOptions

type MemcachedSetOptions struct {
	Key        string
	Value      string
	Expiration int32
}

MemcachedSetOptions contains attributes that can alter the behavior of the memcached "SET" check.

"Key" is _required_; the name of the key we are attempting to "SET".

"Value" is optional; what the value should hold; if not set, it will be set to "MemcachedDefaultSetValue".

"Expiration" is optional; if set, a TTL will be attached to the key.

Jump to

Keyboard shortcuts

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