cache

package
v0.0.0-...-654e1bf Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCacheMissed = errors.New("cache miss")
)

Functions

This section is empty.

Types

type Client

type Client interface {
	Set(ctx context.Context, key string, value any, ttl time.Duration) error
	Get(ctx context.Context, key string) (any, error)
	AddToSet(ctx context.Context, key string, value ...any) error
	IsValueInSet(ctx context.Context, key string, value any) (bool, error)
}

func NewClient

func NewClient(
	cacheConfig configs.Cache,
	logger *zap.Logger,
) (Client, error)

func NewInMemoryClient

func NewInMemoryClient(
	cacheConfig configs.Cache,
	logger *zap.Logger,
) (Client, error)

func NewRedisClient

func NewRedisClient(
	cacheConfig configs.Cache,
	logger *zap.Logger,
) (Client, error)

type TakenAccountName

type TakenAccountName interface {
	Add(ctx context.Context, accountName string) error
	Has(ctx context.Context, accountName string) (bool, error)
}

func NewTakenAccountName

func NewTakenAccountName(client Client) (TakenAccountName, error)

type TokenPublicKey

type TokenPublicKey interface {
	Set(ctx context.Context, tokenPublicKeyID string, tokenPublicKeyValue []byte) error
	Get(ctx context.Context, tokenPublicKeyID string) ([]byte, error)
}

func NewTokenPublicKey

func NewTokenPublicKey(client Client) (TokenPublicKey, error)

Jump to

Keyboard shortcuts

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