persistence

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var StorageTypes = [2]string{"redis", "in_memory"}

Functions

This section is empty.

Types

type Cache

type Cache[T any] interface {
	Create(ctx context.Context, model T) error
	Update(ctx context.Context, model T) error
	GetByKey(ctx context.Context, key string) (obj *T, found bool, err error)
}

type Storage

type Storage struct {
	ContainerImageCache Cache[model.ContainerImage]
}

func InitMemoryCache

func InitMemoryCache(l logger.Logger) *Storage

func InitRedisCache

func InitRedisCache(l logger.Logger, addr string, port string, hc health.Checker) *Storage

type StorageType

type StorageType int
const (
	Redis StorageType = iota
	InMemory
)

func StorageTypeFromString

func StorageTypeFromString(value string) (StorageType, error)

func (StorageType) String

func (s StorageType) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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