cache

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrKeyNotFound = errors.New("key not found in cache")
	ErrGetKey      = errors.New("failed to get key from redis cache")
	ErrPingTimeout = errors.New("redis ping timeout")
)

Functions

This section is empty.

Types

type Cache

type Cache interface {
	Set(ctx context.Context, key string, value interface{}) error
	Get(ctx context.Context, key string, into interface{}) error
	Delete(ctx context.Context, key string) error
}

type RedisCache

type RedisCache struct {
	// contains filtered or unexported fields
}

func NewRedisCache

func NewRedisCache(addr string, ttl time.Duration) (*RedisCache, error)

func (*RedisCache) Delete

func (r *RedisCache) Delete(ctx context.Context, key string) error

func (*RedisCache) Get

func (r *RedisCache) Get(ctx context.Context, key string, into interface{}) error

func (*RedisCache) Set

func (r *RedisCache) Set(ctx context.Context, key string, value interface{}) error

func (*RedisCache) Stop

func (r *RedisCache) Stop() error

Jump to

Keyboard shortcuts

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