elasticache

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package elasticache provides an in-memory mock implementation of AWS ElastiCache.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Mock

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

Mock is an in-memory mock implementation of the AWS ElastiCache service.

func New

func New(opts *config.Options) *Mock

New creates a new ElastiCache mock with the given configuration options.

func (*Mock) CreateCache

func (m *Mock) CreateCache(_ context.Context, cfg driver.CacheConfig) (*driver.CacheInfo, error)

CreateCache creates a new ElastiCache cluster.

func (*Mock) Decr added in v1.3.1

func (m *Mock) Decr(ctx context.Context, cacheName, key string) (int64, error)

Decr atomically decrements the integer value of a key by 1.

func (*Mock) DecrBy added in v1.3.1

func (m *Mock) DecrBy(_ context.Context, cacheName, key string, delta int64) (int64, error)

DecrBy atomically decrements the integer value of a key by delta.

func (*Mock) Delete

func (m *Mock) Delete(_ context.Context, cacheName, key string) error

Delete removes a value from the cache.

func (*Mock) DeleteCache

func (m *Mock) DeleteCache(_ context.Context, name string) error

DeleteCache deletes an ElastiCache cluster by name.

func (*Mock) Expire added in v1.3.1

func (m *Mock) Expire(_ context.Context, cacheName, key string, ttl time.Duration) error

Expire sets a TTL on an existing key.

func (*Mock) FlushAll

func (m *Mock) FlushAll(_ context.Context, cacheName string) error

FlushAll removes all items from the cache.

func (*Mock) Get

func (m *Mock) Get(_ context.Context, cacheName, key string) (*driver.Item, error)

Get retrieves a value from the cache.

func (*Mock) GetCache

func (m *Mock) GetCache(_ context.Context, name string) (*driver.CacheInfo, error)

GetCache retrieves information about an ElastiCache cluster.

func (*Mock) GetTTL added in v1.3.1

func (m *Mock) GetTTL(_ context.Context, cacheName, key string) (time.Duration, error)

GetTTL returns the remaining TTL for a key. Returns -1 if the key has no TTL.

func (*Mock) Incr added in v1.3.1

func (m *Mock) Incr(ctx context.Context, cacheName, key string) (int64, error)

Incr atomically increments the integer value of a key by 1.

func (*Mock) IncrBy added in v1.3.1

func (m *Mock) IncrBy(_ context.Context, cacheName, key string, delta int64) (int64, error)

IncrBy atomically increments the integer value of a key by delta.

func (*Mock) Keys

func (m *Mock) Keys(_ context.Context, cacheName, pattern string) ([]string, error)

Keys returns all keys matching the given pattern in the cache. Supports "*" as a wildcard. Empty pattern returns all keys.

func (*Mock) ListCaches

func (m *Mock) ListCaches(_ context.Context) ([]driver.CacheInfo, error)

ListCaches lists all ElastiCache clusters.

func (*Mock) Persist added in v1.3.1

func (m *Mock) Persist(_ context.Context, cacheName, key string) error

Persist removes the TTL from a key, making it persistent.

func (*Mock) Set

func (m *Mock) Set(_ context.Context, cacheName, key string, value []byte, ttl time.Duration) error

Set stores a value in the cache with an optional TTL.

func (*Mock) SetMonitoring

func (m *Mock) SetMonitoring(mon mondriver.Monitoring)

SetMonitoring sets the monitoring backend for auto-metric generation.

Jump to

Keyboard shortcuts

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