cache

package
v1.0.12 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ICache

type ICache interface {
	Type() string
	Get(key string) (string, error)
	Set(key string, val any, expiration time.Duration) error
	Del(key string) error
	HGet(hk, field string) (string, error)
	HDel(hk, fields string) error
	Incr(key string) error
	Decr(key string) error
	Expire(key string, expiration time.Duration) error
}

func New

func New(conf config.CacheCfg) ICache

type Memory

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

func NewMemory

func NewMemory() *Memory

NewMemory memory模式

func (*Memory) Decr

func (m *Memory) Decr(key string) error

func (*Memory) Del

func (m *Memory) Del(key string) error

func (*Memory) Expire

func (m *Memory) Expire(key string, dur time.Duration) error

func (*Memory) Get

func (m *Memory) Get(key string) (string, error)

func (*Memory) GetClient

func (m *Memory) GetClient() *Memory

func (*Memory) HDel

func (m *Memory) HDel(hk, key string) error

func (*Memory) HGet

func (m *Memory) HGet(hk, key string) (string, error)

func (*Memory) Incr

func (m *Memory) Incr(key string) error

func (*Memory) Set

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

func (*Memory) Type

func (*Memory) Type() string

type RedisCache

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

func (*RedisCache) Decr

func (c *RedisCache) Decr(key string) error

func (*RedisCache) Del

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

func (*RedisCache) Expire

func (c *RedisCache) Expire(key string, expiration time.Duration) error

func (*RedisCache) Get

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

func (*RedisCache) GetClient

func (c *RedisCache) GetClient() redis.UniversalClient

func (*RedisCache) HDel

func (c *RedisCache) HDel(hk, fields string) error

func (*RedisCache) HGet

func (c *RedisCache) HGet(hk, field string) (string, error)

func (*RedisCache) Incr

func (c *RedisCache) Incr(key string) error

func (*RedisCache) Set

func (c *RedisCache) Set(key string, val any, expiration time.Duration) error

func (*RedisCache) Type

func (c *RedisCache) Type() string

Jump to

Keyboard shortcuts

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