cache

package
v0.0.0-...-f4f4368 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RetrieveSolution

func RetrieveSolution(ctx context.Context, cache CacheService, measurement *models.NewMeasurement) (*models.Solution, error)

RetrieveSolution retrieves the serialized Solution from the cache and deserializes it.

func StoreSolution

func StoreSolution(ctx context.Context, cache CacheService, measurement *models.NewMeasurement, solution *models.Solution, expiration time.Duration) error

StoreSolution stores the serialized Solution in the cache.

Types

type CacheService

type CacheService interface {
	// Get retrieves the value associated with the given key from the cache.
	Get(ctx context.Context, key string) (string, error)
	// Set sets the value associated with the given key in the cache.
	Set(ctx context.Context, key string, value interface{}, expiration time.Duration) error
}

CacheService defines the interface for a cache.

func NewRedisCache

func NewRedisCache(ctx context.Context, host, port string) (CacheService, error)

NewRedisCache creates a new Redis cache instance.

Jump to

Keyboard shortcuts

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