cache

package
v0.0.0-...-aefe3a2 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const LUA_ST_INC = `` /* 298-byte string literal not displayed */

LUA_ST_INC 带判断的自增脚本,-1则为超限,否则返回当前值。

Variables

This section is empty.

Functions

func BuildRedisKey

func BuildRedisKey(b BaseCacheKey, name, key string) string

func DefaultRedisOption

func DefaultRedisOption() redis.Options

func InitRedis

func InitRedis(ctx context.Context) error

Types

type BaseCacheKey

type BaseCacheKey string
const (
	VerifyCodeKey BaseCacheKey = "loza:verifycode" // 验证码
)

type EmbeddedCache

type EmbeddedCache struct {
}

func NewEmbeddedCache

func NewEmbeddedCache() *EmbeddedCache

func (*EmbeddedCache) Delete

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

func (*EmbeddedCache) Get

func (c *EmbeddedCache) Get(key string) interface{}

func (*EmbeddedCache) IsExist

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

func (*EmbeddedCache) Set

func (c *EmbeddedCache) Set(key string, val interface{}, timeout time.Duration) error

func (*EmbeddedCache) SetNX

func (c *EmbeddedCache) SetNX(key string, val interface{}, timeout time.Duration) (bool, error)

type RedisCache

type RedisCache struct {
}

func NewRedisCache

func NewRedisCache() *RedisCache

func (*RedisCache) Delete

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

func (*RedisCache) Get

func (c *RedisCache) Get(key string) interface{}

func (*RedisCache) IsExist

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

func (*RedisCache) Set

func (c *RedisCache) Set(key string, val interface{}, timeout time.Duration) error

func (*RedisCache) SetNX

func (c *RedisCache) SetNX(key string, val interface{}, timeout time.Duration) (bool, error)

func (*RedisCache) TTL

func (c *RedisCache) TTL(key string) time.Duration

Jump to

Keyboard shortcuts

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