cache

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2024 License: MIT Imports: 12 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[Entity any] interface {
	Entries(
		ctx context.Context,
	) (map[string]Entity, error)

	Keys(
		ctx context.Context,
	) ([]string, error)

	Values(
		ctx context.Context,
	) ([]Entity, error)

	Set(
		ctx context.Context,
		key string,
		value Entity,
		retention time.Duration,
	) error

	Get(
		ctx context.Context,
		key string,
	) (*Entity, error)

	Remove(
		ctx context.Context,
		key string,
	) error

	RemainingRetention(
		ctx context.Context,
		key string,
	) (time.Duration, error)
}

func NewMemoryCache

func NewMemoryCache[Entity any]() Cache[Entity]

func NewRedisCache

func NewRedisCache[Entity any](
	redisURL string,
	redisPassword string,
	key string,
) Cache[Entity]

func NewRueidisCache added in v0.5.0

func NewRueidisCache[Entity any](
	redisURL string,
	redisPassword string,
	key string,
) (Cache[Entity], error)

Jump to

Keyboard shortcuts

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