Documentation ¶
Index ¶
- Variables
- type Big
- type BigCache
- type BigConfig
- type Go
- type GoCache
- type GoCacheConfig
- type GoConfig
- type GttInterfaceFunc
- type GttStringFunc
- type Redis
- func (r *Redis) Decr(key string) (int64, error)
- func (r *Redis) DecrBy(key string, value int64) (int64, error)
- func (r *Redis) Del(keys ...string) error
- func (r *Redis) Get(key string) (string, error)
- func (r *Redis) GetInterface(key string, result interface{}) error
- func (r *Redis) GetSet(key string, value interface{}) (string, error)
- func (r *Redis) Incr(key string) (int64, error)
- func (r *Redis) IncrBy(key string, value int64) (int64, error)
- func (r *Redis) MGet(keys ...string) ([]interface{}, error)
- func (r *Redis) MSet(values map[string]interface{}) error
- func (r *Redis) NewCache(config *RedisCacheConfig) *RedisCache
- func (r *Redis) NewCacheDefaultExpiration() *RedisCache
- func (r *Redis) Set(key string, value interface{}, expiration time.Duration) (string, error)
- func (r *Redis) SetDefaultExpiration(key string, value interface{}) (string, error)
- func (r *Redis) SetInterface(key string, value interface{}, expiration time.Duration) (string, error)
- func (r *Redis) SetInterfaceDefaultExpiration(key string, value interface{}) (string, error)
- func (r *Redis) SetNX(key string, value interface{}, expiration time.Duration) error
- func (r *Redis) SetNXDefaultExpiration(key string, value interface{}) error
- type RedisCache
- type RedisCacheConfig
- type RedisConfig
Constants ¶
This section is empty.
Variables ¶
var (
DefaultExpiration = time.Minute * 30 // 默认过期时间
)
Functions ¶
This section is empty.
Types ¶
type BigCache ¶
type BigCache struct { GetterInterface GttInterfaceFunc // 不存在的操作 // contains filtered or unexported fields }
BigCache https://github.com/allegro/bigcache
func (*BigCache) GetInterface ¶
GetInterface 缓存操作
type Go ¶
type Go struct {
// contains filtered or unexported fields
}
Go https://github.com/patrickmn/go-cache
func (*Go) SetDefault ¶
SetDefault 插入数据 并设置为默认过期时间
type GoCache ¶
type GoCache struct { GetterInterface GttInterfaceFunc // 不存在的操作 // contains filtered or unexported fields }
GoCache https://github.com/patrickmn/go-cache
func (*GoCache) GetInterface ¶
GetInterface 缓存操作
type GoCacheConfig ¶
type GoCacheConfig struct {
// contains filtered or unexported fields
}
GoCacheConfig 配置
type GoConfig ¶
type GoConfig struct { DefaultExpiration time.Duration // 默认过期时间 DefaultClear time.Duration // 清理过期数据 }
GoConfig 配置
type Redis ¶
type Redis struct { Client *dorm.RedisClient // 驱动 // contains filtered or unexported fields }
Redis https://github.com/go-redis/redis
func (*Redis) GetInterface ¶
GetInterface 查询key的值
func (*Redis) MSet ¶
MSet 批量设置key的值 MSet(map[string]interface{}{"key1": "value1", "key2": "value2"})
func (*Redis) NewCache ¶
func (r *Redis) NewCache(config *RedisCacheConfig) *RedisCache
NewCache 实例化
func (*Redis) NewCacheDefaultExpiration ¶
func (r *Redis) NewCacheDefaultExpiration() *RedisCache
NewCacheDefaultExpiration 实例化
func (*Redis) SetDefaultExpiration ¶
SetDefaultExpiration 设置一个key的值,使用全局默认过期时间
func (*Redis) SetInterface ¶
func (r *Redis) SetInterface(key string, value interface{}, expiration time.Duration) (string, error)
SetInterface 设置一个key的值
func (*Redis) SetInterfaceDefaultExpiration ¶
SetInterfaceDefaultExpiration 设置一个key的值,使用全局默认过期时间
func (*Redis) SetNXDefaultExpiration ¶
SetNXDefaultExpiration 如果key不存在,则设置这个key的值,使用全局默认过期时间
type RedisCache ¶
type RedisCache struct { GetterString GttStringFunc // 不存在的操作 GetterInterface GttInterfaceFunc // 不存在的操作 // contains filtered or unexported fields }
RedisCache https://github.com/go-redis/redis
func (*RedisCache) GetInterface ¶
func (rc *RedisCache) GetInterface(key string, result interface{})
GetInterface 缓存操作
func (*RedisCache) GetString ¶
func (rc *RedisCache) GetString(key string) (ret string)
GetString 缓存操作
type RedisCacheConfig ¶
type RedisCacheConfig struct {
// contains filtered or unexported fields
}
RedisCacheConfig 配置
type RedisConfig ¶
type RedisConfig struct { DefaultExpiration time.Duration // 默认过期时间 Client *dorm.RedisClient // 驱动,可选 Debug bool // 调试,可选 }
RedisConfig 配置