Documentation
¶
Index ¶
- Constants
- func BuildRedisKey(b BaseCacheKey, name, key string) string
- func DefaultRedisOption() redis.Options
- func InitRedis(ctx context.Context) error
- type BaseCacheKey
- type EmbeddedCache
- func (c *EmbeddedCache) Delete(key string) error
- func (c *EmbeddedCache) Get(key string) interface{}
- func (c *EmbeddedCache) IsExist(key string) bool
- func (c *EmbeddedCache) Set(key string, val interface{}, timeout time.Duration) error
- func (c *EmbeddedCache) SetNX(key string, val interface{}, timeout time.Duration) (bool, error)
- type RedisCache
- func (c *RedisCache) Delete(key string) error
- func (c *RedisCache) Get(key string) interface{}
- func (c *RedisCache) IsExist(key string) bool
- func (c *RedisCache) Set(key string, val interface{}, timeout time.Duration) error
- func (c *RedisCache) SetNX(key string, val interface{}, timeout time.Duration) (bool, error)
- func (c *RedisCache) TTL(key string) time.Duration
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
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
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
Click to show internal directories.
Click to hide internal directories.