memorystore

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: May 25, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package memorystore provides an in-memory mock implementation of GCP Memorystore.

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 GCP Memorystore.

func New

func New(opts *config.Options) *Mock

New creates a new Memorystore 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 Memorystore instance.

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(ctx 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(ctx 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 a Memorystore instance 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(ctx 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 a Memorystore instance.

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(ctx 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.

func (*Mock) ListCaches

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

ListCaches lists all Memorystore instances.

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(ctx 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