flux: github.com/weaveworks/flux/pkg/registry/cache/memcached Index | Files

package memcached

import "github.com/weaveworks/flux/pkg/registry/cache/memcached"

This package implements an image DB cache using memcached.

Items are given an expiry based on their refresh deadline, with a minimum duration to try and ensure things will expire well after they would have been refreshed (i.e., only if they truly need garbage collection).

memcached will still evict things when under memory pressure. We can recover from that -- we'll just get a cache miss, and fetch it again.

Index

Package Files

memcached.go

Constants

const (
    // The minimum expiry given to an entry.
    MinExpiry = time.Hour
)

type MemcacheClient Uses

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 Uses

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

Does not use DNS, accepts static list of servers.

func NewMemcacheClient Uses

func NewMemcacheClient(config MemcacheConfig) *MemcacheClient

func (*MemcacheClient) GetKey Uses

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

GetKey gets the value and its refresh deadline from the cache.

func (*MemcacheClient) SetKey Uses

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

SetKey sets the value and its refresh deadline at a key. NB the key expiry is set _longer_ than the deadline, to give us a grace period in which to refresh the value.

func (*MemcacheClient) Stop Uses

func (c *MemcacheClient) Stop()

Stop the memcache client.

type MemcacheConfig Uses

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

MemcacheConfig defines how a MemcacheClient should be constructed.

Package memcached imports 10 packages (graph). Updated 2019-09-29. Refresh now. Tools for package owners.