cache

package
v0.7.3 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2024 License: MIT Imports: 10 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], error)

Jump to

Keyboard shortcuts

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