caches

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCacheDataNotFound = errors.New("cache data not found")
)

Functions

This section is empty.

Types

type CacheInf

type CacheInf[K huago.KeyAble, V any] interface {
	Clean() error
	Get(key K) (V, error)
	Set(key K, value V) error
	Del(key K) error
}

type RedisCache

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

func NewRedisCache

func NewRedisCache(client *redis.Client, expiresTime time.Duration) *RedisCache

func (*RedisCache) Clean

func (r *RedisCache) Clean() error

func (*RedisCache) Del

func (r *RedisCache) Del(key string) error

func (*RedisCache) Get

func (r *RedisCache) Get(key string) (string, error)

func (*RedisCache) Set

func (r *RedisCache) Set(key string, value string) error

type TableCache

type TableCache[K huago.KeyAble, V any] struct {
	// contains filtered or unexported fields
}

func NewTableCache

func NewTableCache[K huago.KeyAble, V any](h TableHandlerFunc[K, V]) *TableCache[K, V]

func (*TableCache[K, V]) Clean

func (c *TableCache[K, V]) Clean() error

func (*TableCache[K, V]) Del

func (c *TableCache[K, V]) Del(key K) error

func (*TableCache[K, V]) Get

func (c *TableCache[K, V]) Get(key K) (V, error)

func (*TableCache[K, V]) Set

func (c *TableCache[K, V]) Set(key K, val V) error

type TableHandlerFunc

type TableHandlerFunc[K huago.KeyAble, V any] func(key K) (V, error)

Jump to

Keyboard shortcuts

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