memcache

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2023 License: GPL-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const Type = "memcache"

Variables

This section is empty.

Functions

func NewMemCache

func NewMemCache(ctx context.Context, _ adapter.Core, logger log.Logger, tag string, args any) (adapter.PluginExecutor, error)

Types

type Args

type Args struct {
	DumpPath     string         `json:"dump-path"`
	DumpInterval utils.Duration `json:"dump-interval"`
}

type CacheMap

type CacheMap[T any] struct {
	// contains filtered or unexported fields
}

func Decode

func Decode[T any](ctx context.Context, raw []byte) (*CacheMap[T], error)

func NewCacheMap

func NewCacheMap[T any](ctx context.Context) *CacheMap[T]

func (*CacheMap[T]) Close

func (m *CacheMap[T]) Close()

func (*CacheMap[T]) Delete

func (m *CacheMap[T]) Delete(key string)

func (*CacheMap[T]) Encode

func (m *CacheMap[T]) Encode() ([]byte, error)

func (*CacheMap[T]) FlushAll

func (m *CacheMap[T]) FlushAll()

func (*CacheMap[T]) Get

func (m *CacheMap[T]) Get(key string) (T, bool)

func (*CacheMap[T]) Set

func (m *CacheMap[T]) Set(key string, value T, ttl time.Duration)

func (*CacheMap[T]) Start

func (m *CacheMap[T]) Start()

type Item

type Item[T any] struct {
	Value    T              `json:"value"`
	TTL      utils.Duration `json:"ttl"`
	Deadline time.Time      `json:"-"`
}

type MemCache

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

func (*MemCache) APIHandler

func (m *MemCache) APIHandler() chi.Router

func (*MemCache) Close

func (m *MemCache) Close() error

func (*MemCache) Exec

func (m *MemCache) Exec(ctx context.Context, dnsCtx *adapter.DNSContext, argsID uint16) (adapter.ReturnMode, error)

func (*MemCache) LoadRunningArgs

func (m *MemCache) LoadRunningArgs(_ context.Context, args any) (uint16, error)

func (*MemCache) Start

func (m *MemCache) Start() error

func (*MemCache) Tag

func (m *MemCache) Tag() string

func (*MemCache) Type

func (m *MemCache) Type() string

Jump to

Keyboard shortcuts

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