memcache

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MemcacheConfig

type MemcacheConfig struct {
	Servers      []string      `json:"servers"`
	MaxIdleConns int           `json:"max_idle_conns"`
	Timeout      time.Duration `json:"timeout"`
	KeyPrefix    string        `json:"key_prefix"`
	Namespace    string        `json:"namespace"`
	MaxKeySize   int           `json:"max_key_size"`
	MaxValueSize int           `json:"max_value_size"`
}

MemcacheConfig holds Memcached-specific configuration

type MemcacheProvider

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

MemcacheProvider implements the CacheProvider interface for Memcached

func NewMemcacheProvider

func NewMemcacheProvider(config *MemcacheConfig, logger *logrus.Logger) *MemcacheProvider

NewMemcacheProvider creates a new Memcached cache provider

func (*MemcacheProvider) Connect

func (m *MemcacheProvider) Connect(ctx context.Context) error

Connect establishes connection to Memcached

func (*MemcacheProvider) Delete

func (m *MemcacheProvider) Delete(ctx context.Context, key string) error

Delete removes a value from Memcached

func (*MemcacheProvider) DeleteMultiple

func (m *MemcacheProvider) DeleteMultiple(ctx context.Context, keys []string) error

DeleteMultiple removes multiple values from Memcached

func (*MemcacheProvider) Disconnect

func (m *MemcacheProvider) Disconnect(ctx context.Context) error

Disconnect closes the Memcached connection

func (*MemcacheProvider) Exists

func (m *MemcacheProvider) Exists(ctx context.Context, key string) (bool, error)

Exists checks if a key exists in Memcached

func (*MemcacheProvider) Flush

func (m *MemcacheProvider) Flush(ctx context.Context) error

Flush clears all cache data

func (*MemcacheProvider) Get

func (m *MemcacheProvider) Get(ctx context.Context, key string, dest interface{}) error

Get retrieves a value from Memcached

func (*MemcacheProvider) GetConnectionInfo

func (m *MemcacheProvider) GetConnectionInfo() *types.ConnectionInfo

GetConnectionInfo returns connection information

func (*MemcacheProvider) GetKeys

func (m *MemcacheProvider) GetKeys(ctx context.Context, pattern string) ([]string, error)

GetKeys returns keys matching a pattern (not supported by Memcached)

func (*MemcacheProvider) GetMultiple

func (m *MemcacheProvider) GetMultiple(ctx context.Context, keys []string) (map[string]interface{}, error)

GetMultiple retrieves multiple values from Memcached

func (*MemcacheProvider) GetName

func (m *MemcacheProvider) GetName() string

GetName returns the provider name

func (*MemcacheProvider) GetStats

func (m *MemcacheProvider) GetStats(ctx context.Context) (*types.CacheStats, error)

GetStats returns Memcached cache statistics

func (*MemcacheProvider) GetSupportedFeatures

func (m *MemcacheProvider) GetSupportedFeatures() []types.CacheFeature

GetSupportedFeatures returns the features supported by Memcached

func (*MemcacheProvider) GetTTL

func (m *MemcacheProvider) GetTTL(ctx context.Context, key string) (time.Duration, error)

GetTTL returns the TTL of a key (not directly supported by Memcached)

func (*MemcacheProvider) InvalidateByTag

func (m *MemcacheProvider) InvalidateByTag(ctx context.Context, tag string) error

InvalidateByTag invalidates all keys with a specific tag

func (*MemcacheProvider) IsConnected

func (m *MemcacheProvider) IsConnected() bool

IsConnected returns the connection status

func (*MemcacheProvider) Ping

func (m *MemcacheProvider) Ping(ctx context.Context) error

Ping tests the Memcached connection

func (*MemcacheProvider) Set

func (m *MemcacheProvider) Set(ctx context.Context, key string, value interface{}, ttl time.Duration) error

Set stores a value in Memcached

func (*MemcacheProvider) SetMultiple

func (m *MemcacheProvider) SetMultiple(ctx context.Context, items map[string]interface{}, ttl time.Duration) error

SetMultiple stores multiple values in Memcached

func (*MemcacheProvider) SetTTL

func (m *MemcacheProvider) SetTTL(ctx context.Context, key string, ttl time.Duration) error

SetTTL sets the TTL of a key

func (*MemcacheProvider) SetWithTags

func (m *MemcacheProvider) SetWithTags(ctx context.Context, key string, value interface{}, ttl time.Duration, tags []string) error

SetWithTags stores a value with tags (not supported by Memcached, but we can store tags as separate keys)

Jump to

Keyboard shortcuts

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