valkeycache

package
v0.0.0-...-1d79d95 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2026 License: Apache-2.0 Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ValkeyDataCache

type ValkeyDataCache[K comparable, V []byte] struct {
	// contains filtered or unexported fields
}

ValkeyDataCache is a cache that relies on valkey. It uses generics so that users of it can uses any type of data they want. The key K must be of type comparable. More infomration here: https://go.dev/blog/comparable The value V can be any type.

func NewValkeyDataCache

func NewValkeyDataCache[K comparable, V []byte](
	keyPrefix string,
	host string,
	port string,
	ttl time.Duration) (*ValkeyDataCache[K, V], error)

NewValkeyDataCache creates a new ValkeyDataCache instance.

func (*ValkeyDataCache[K, V]) Cache

func (c *ValkeyDataCache[K, V]) Cache(
	ctx context.Context,
	key K,
	in V,
	options ...cachetypes.CacheOption,
) error

Cache stores a value in the cache.

func (*ValkeyDataCache[K, V]) Get

func (c *ValkeyDataCache[K, V]) Get(
	ctx context.Context,
	key K,
) (V, error)

Get retrieves a value from the cache. It returns cachetypes.ErrCachedDataNotFound if it does not exist. nolint: ireturn // V is not a interface always. Can ignore this.

Jump to

Keyboard shortcuts

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