redis

package
v1.8.7 Latest Latest
Warning

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

Go to latest
Published: May 26, 2022 License: MIT Imports: 7 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache added in v0.3.1

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

Cache 缓存

func NewCache

func NewCache(conf *Config) *Cache

NewCache new an redis cache instance

func (*Cache) ClearAll added in v0.3.1

func (c *Cache) ClearAll() error

ClearAll todo

func (*Cache) Close added in v0.3.1

func (c *Cache) Close() error

Close todo

func (*Cache) Decr added in v0.3.1

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

Decr todo

func (*Cache) Delete added in v0.3.1

func (c *Cache) Delete(key string) error

Delete todo

func (*Cache) Get added in v0.3.1

func (c *Cache) Get(key string, val interface{}) error

Get todo

func (*Cache) Incr added in v0.3.1

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

Incr todo

func (*Cache) IsExist added in v0.3.1

func (c *Cache) IsExist(key string) bool

IsExist todo

func (*Cache) ListKey added in v0.5.1

func (c *Cache) ListKey(req *cache.ListKeyRequest) (*cache.ListKeyResponse, error)

ListKey todo

func (*Cache) Put added in v0.3.1

func (c *Cache) Put(key string, val interface{}) error

Put todo

func (*Cache) PutWithTTL added in v0.3.1

func (c *Cache) PutWithTTL(key string, val interface{}, ttl time.Duration) error

PutWithTTL todo

func (*Cache) SetDefaultTTL added in v0.3.1

func (c *Cache) SetDefaultTTL(ttl time.Duration)

SetDefaultTTL todo

func (*Cache) WithContext added in v0.3.2

func (c *Cache) WithContext(ctx context.Context) cache.Cache

WithContext 启用上下文, 方便trace

type Config added in v0.3.1

type Config struct {
	Prefix     string `json:"prefix,omitempty" yaml:"prefix" toml:"prefix" env:"MCUBE_CACHE_PREFIX"`
	Address    string `json:"address,omitempty" yaml:"address" toml:"address" env:"MCUBE_CACHE_ADDRESS"`
	DB         int    `json:"db,omitempty" yaml:"db" toml:"db" env:"MCUBE_CACHE_DB"`
	Password   string `json:"password,omitempty" yaml:"password" toml:"password" env:"MCUBE_CACHE_PASSWORD"`
	DefaultTTL int    `json:"default_ttl,omitempty" yaml:"default_ttl" toml:"default_ttl" env:"MCUBE_CACHE_TTL"`
}

Config 配置

func NewDefaultConfig added in v0.3.1

func NewDefaultConfig() *Config

NewDefaultConfig 默认配置

Jump to

Keyboard shortcuts

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