cache

package
v0.0.0-...-76b0ba7 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("Not Found")

Functions

This section is empty.

Types

type Cache

type Cache[T any] interface {
	Get(ctx context.Context, key string) (*T, error)
	Set(ctx context.Context, key string, val T) error
	Del(ctx context.Context, key string) error
}

type InMemory

type InMemory[T any] struct {
	// contains filtered or unexported fields
}

func NewInMemory

func NewInMemory[T any](client *redis.Client) *InMemory[T]

func (*InMemory[T]) Del

func (im *InMemory[T]) Del(
	ctx context.Context,
	key string,
) error

func (*InMemory[T]) Get

func (im *InMemory[T]) Get(
	ctx context.Context,
	key string,
) (*T, error)

func (*InMemory[T]) Set

func (im *InMemory[T]) Set(
	ctx context.Context,
	key string,
	val T,
) error

type Rueidis

type Rueidis[T any] struct {
	// contains filtered or unexported fields
}

func NewRueidis

func NewRueidis[T any](client rueidis.Client) *Rueidis[T]

func (*Rueidis[T]) Del

func (rue *Rueidis[T]) Del(
	ctx context.Context,
	key string,
) error

func (*Rueidis[T]) Get

func (rue *Rueidis[T]) Get(
	ctx context.Context,
	key string,
) (*T, error)

func (*Rueidis[T]) Set

func (rue *Rueidis[T]) Set(
	ctx context.Context,
	key string,
	val T,
) error

Jump to

Keyboard shortcuts

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