cache

package
v0.0.0-...-2ff8efa Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cacher

type Cacher interface {
	Get(key string, value interface{}) error
	Set(key string, value interface{}, expiration time.Duration) error
	Delete(keys ...string) error
}

func NewCache

func NewCache(ctx context.Context, conf *config.Config) Cacher

type MemoryCache

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

func NewMemoryCache

func NewMemoryCache(size int) *MemoryCache

func (*MemoryCache) Delete

func (m *MemoryCache) Delete(keys ...string) error

func (*MemoryCache) Get

func (m *MemoryCache) Get(key string, value interface{}) error

func (*MemoryCache) Set

func (m *MemoryCache) Set(key string, value interface{}, expiration time.Duration) error

type RedisCache

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

func NewRedisCache

func NewRedisCache(ctx context.Context, client *redis.Client) *RedisCache

func (*RedisCache) Delete

func (r *RedisCache) Delete(keys ...string) error

func (*RedisCache) Get

func (r *RedisCache) Get(key string, value interface{}) error

func (*RedisCache) Set

func (r *RedisCache) Set(key string, value interface{}, expiration time.Duration) error

Jump to

Keyboard shortcuts

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