cache

package
v0.0.0-...-6efa544 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2025 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache interface {
	// Set stores a value associated with the given key in the cache.
	// The value will expire and be automatically removed after the specified duration.
	Set(ctx context.Context, key string, value interface{}, expiration time.Duration) error
	// Get retrieves the value associated with the given key from the cache.
	// If the key is not found, it should return (nil, nil).
	Get(ctx context.Context, key string) (interface{}, error)
	// Del removes the value associated with the given key from the cache.
	// It is a no-op if the key does not exist.
	Del(ctx context.Context, key string) error
	// Close closes the cache and releases any open resources.
	Close() error
}

Cache defines a generic interface for a key-value cache

func NewRedisCache

func NewRedisCache(connURL string) (Cache, error)

type RedisCache

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

func (*RedisCache) Close

func (rc *RedisCache) Close() error

func (*RedisCache) Del

func (rc *RedisCache) Del(ctx context.Context, key string) error

func (*RedisCache) Get

func (rc *RedisCache) Get(ctx context.Context, key string) (interface{}, error)

func (*RedisCache) Set

func (rc *RedisCache) Set(ctx context.Context, key string, value interface{}, expiration time.Duration) error

Directories

Path Synopsis
Package mockcache is a generated GoMock package.
Package mockcache is a generated GoMock package.

Jump to

Keyboard shortcuts

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