cache

package
v0.0.0-...-a693937 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2025 License: MIT Imports: 8 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 adds a key-value pair to the cache with an optional expiration time.
	Set(ctx context.Context, key string, metadata *pb.Metadata) error

	// Get retrieves a value from the cache by its key.
	// Returns the value and a boolean indicating if the key was found.
	Get(ctx context.Context, key string) (*pb.Metadata, bool, error)

	// Delete removes a key-value pair from the cache by its key.
	Delete(ctx context.Context, key string) error

	// Clear removes all entries from the cache.
	Clear(ctx context.Context) error

	// Close cache conection
	Close() error
}

Cache defines the behavior for a cache implementation.

func NewRedisCache

func NewRedisCache(redisAddr string) (Cache, error)

NewRedisCache initializes a new Redis cache instance

Jump to

Keyboard shortcuts

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