cache

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2025 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache interface {
	Get(key string) (value any, err error)
	Set(key string, value any, expire time.Duration) error
	Delete(key string) error
	Clean()
}

func GetMemoryCache

func GetMemoryCache() Cache

func NewMemoryCache

func NewMemoryCache() Cache

type Config

type Config struct {
	Host     string
	Port     int
	Username string
	Password string
}

type Data

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

func (*Data) Expired

func (d *Data) Expired() bool

type MemoryCache

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

func (*MemoryCache) Clean

func (m *MemoryCache) Clean()

Clean implements Cache.

func (*MemoryCache) Delete

func (m *MemoryCache) Delete(key string) error

Delete implements Cache.

func (*MemoryCache) Gc

func (m *MemoryCache) Gc()

func (*MemoryCache) Get

func (m *MemoryCache) Get(key string) (value any, err error)

Get implements Cache.

func (*MemoryCache) Set

func (m *MemoryCache) Set(key string, value any, expire time.Duration) error

Set implements Cache.

type Option

type Option struct {
}

type RedisClient

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

func NewRedisClient

func NewRedisClient(cfg *Config) *RedisClient

func (*RedisClient) Clean

func (*RedisClient) Clean()

Clean implements Cache.

func (*RedisClient) Client added in v1.10.0

func (rdb *RedisClient) Client() *redis.Client

func (*RedisClient) Delete

func (rdb *RedisClient) Delete(key string) error

Delete implements Cache.

func (*RedisClient) Get

func (rdb *RedisClient) Get(key string) (value any, err error)

Get implements Cache.

func (*RedisClient) Set

func (rdb *RedisClient) Set(key string, value any, expire time.Duration) error

Set implements Cache.

Jump to

Keyboard shortcuts

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