Documentation ¶
Index ¶
- func RedisDo(conn redis.Conn) func(cmd string, args ...interface{}) (interface{}, error)
- type Redis
- type RedisCache
- func (cache *RedisCache) Del(key string) error
- func (cache *RedisCache) Exists(key string) (bool, error)
- func (cache *RedisCache) Expire(key string, timeout time.Duration) error
- func (cache *RedisCache) Get(key string) ([]byte, error)
- func (cache *RedisCache) GetInts(key string) ([]int, error)
- func (cache *RedisCache) GetString(key string) (string, error)
- func (cache *RedisCache) GetStringMap(key string) (map[string]string, error)
- func (cache *RedisCache) HGet(key, field string) (interface{}, error)
- func (cache *RedisCache) HGetAll(key string) (interface{}, error)
- func (cache *RedisCache) HGetInt64(key, field string) (int64, error)
- func (cache *RedisCache) HGetString(key, field string) (string, error)
- func (cache *RedisCache) HGetUint64(key, field string) (uint64, error)
- func (cache *RedisCache) HIncrBy(key, field string, value interface{}) (int64, error)
- func (cache *RedisCache) HMGet(key string, fields []string) (interface{}, error)
- func (cache *RedisCache) HMset(value []interface{}) (interface{}, error)
- func (cache *RedisCache) HSet(key, field string, value interface{}) (interface{}, error)
- func (cache *RedisCache) HSetWithExpire(key string, timeout time.Duration) (interface{}, error)
- func (cache *RedisCache) Incr(key string) (int64, error)
- func (cache *RedisCache) LRange(key string, start, end int) ([]interface{}, error)
- func (cache *RedisCache) LRem(key string, value interface{}) error
- func (cache *RedisCache) MGet(key []interface{}) (interface{}, error)
- func (cache *RedisCache) MGetValue(keys []interface{}) ([]interface{}, error)
- func (cache *RedisCache) RPush(key string, value interface{}) error
- func (cache *RedisCache) RPushBatch(keys []interface{}) error
- func (cache *RedisCache) SAdd(key string, items string) (int, error)
- func (cache *RedisCache) SIsMember(key string, items string) (int, error)
- func (cache *RedisCache) Set(key string, bytes interface{}, timeout time.Duration) error
- func (cache *RedisCache) SetNX(key string, value interface{}, expiration time.Duration) (bool, error)
- func (cache *RedisCache) Start(config *Redis) error
- func (cache *RedisCache) TTL(key string) (int, error)
- func (cache *RedisCache) ZAdd(key string, value, member interface{}) (interface{}, error)
- func (cache *RedisCache) ZRange(key string, start, end int, withscores bool) ([]string, error)
- func (cache *RedisCache) ZRangeByScore(key string, min_num, max_num int64, withscores bool, offset, count int) ([]int, error)
- func (cache *RedisCache) ZRangeInts(key string, start, end int, withscores bool) ([]int, error)
- func (cache *RedisCache) ZRevrange(key string, start, end int, withscores bool) ([]int, error)
- func (cache *RedisCache) ZRevrangeByScore(key string, max_num, min_num int, withscores bool, offset, count int) ([]int, error)
- func (cache *RedisCache) ZScore(key, member string) (interface{}, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Redis ¶
type Redis struct { Name string Protocol string Host string `conf:"upstream" validate:"@hostname"` Port int Password presets.Password `conf:"env" validate:"@string(0,)"` ConnectTimeout time.Duration ReadTimeout time.Duration WriteTimeout time.Duration IdleTimeout time.Duration MaxActive int MaxIdle int Wait bool DB string // contains filtered or unexported fields }
func (Redis) DockerDefaults ¶
func (r Redis) DockerDefaults() conf.DockerDefaults
func (*Redis) GetCache ¶
func (r *Redis) GetCache() *RedisCache
func (Redis) MarshalDefaults ¶
func (r Redis) MarshalDefaults(v interface{})
type RedisCache ¶
Cache is Redis cache adapter.
func NewRedisCache ¶
func NewRedisCache() *RedisCache
NewRedisCache create new redis cache with default collection name.
func (*RedisCache) Del ¶
func (cache *RedisCache) Del(key string) error
func (*RedisCache) Expire ¶
func (cache *RedisCache) Expire(key string, timeout time.Duration) error
func (*RedisCache) GetStringMap ¶
func (cache *RedisCache) GetStringMap(key string) (map[string]string, error)
func (*RedisCache) HGet ¶
func (cache *RedisCache) HGet(key, field string) (interface{}, error)
func (*RedisCache) HGetAll ¶
func (cache *RedisCache) HGetAll(key string) (interface{}, error)
func (*RedisCache) HGetString ¶
func (cache *RedisCache) HGetString(key, field string) (string, error)
func (*RedisCache) HGetUint64 ¶
func (cache *RedisCache) HGetUint64(key, field string) (uint64, error)
func (*RedisCache) HIncrBy ¶
func (cache *RedisCache) HIncrBy(key, field string, value interface{}) (int64, error)
func (*RedisCache) HMGet ¶
func (cache *RedisCache) HMGet(key string, fields []string) (interface{}, error)
func (*RedisCache) HMset ¶
func (cache *RedisCache) HMset(value []interface{}) (interface{}, error)
func (*RedisCache) HSet ¶
func (cache *RedisCache) HSet(key, field string, value interface{}) (interface{}, error)
func (*RedisCache) HSetWithExpire ¶
func (cache *RedisCache) HSetWithExpire(key string, timeout time.Duration) (interface{}, error)
func (*RedisCache) LRange ¶
func (cache *RedisCache) LRange(key string, start, end int) ([]interface{}, error)
func (*RedisCache) LRem ¶
func (cache *RedisCache) LRem(key string, value interface{}) error
func (*RedisCache) MGet ¶
func (cache *RedisCache) MGet(key []interface{}) (interface{}, error)
func (*RedisCache) MGetValue ¶
func (cache *RedisCache) MGetValue(keys []interface{}) ([]interface{}, error)
func (*RedisCache) RPush ¶
func (cache *RedisCache) RPush(key string, value interface{}) error
func (*RedisCache) RPushBatch ¶
func (cache *RedisCache) RPushBatch(keys []interface{}) error
func (*RedisCache) SIsMember ¶
func (cache *RedisCache) SIsMember(key string, items string) (int, error)
func (*RedisCache) Set ¶
func (cache *RedisCache) Set(key string, bytes interface{}, timeout time.Duration) error
func (*RedisCache) SetNX ¶
func (cache *RedisCache) SetNX(key string, value interface{}, expiration time.Duration) (bool, error)
Redis `SET key value [expiration] NX` command. Zero expiration means the key has no expiration time.
func (*RedisCache) Start ¶
func (cache *RedisCache) Start(config *Redis) error
Start start redis cache adapter. config is like {"key":"collection key","conn":"connection info","dbNum":"0"} the cache item in redis are stored forever, so no gc operation.
func (*RedisCache) ZAdd ¶
func (cache *RedisCache) ZAdd(key string, value, member interface{}) (interface{}, error)
func (*RedisCache) ZRangeByScore ¶
func (*RedisCache) ZRangeInts ¶
func (*RedisCache) ZRevrangeByScore ¶
func (*RedisCache) ZScore ¶
func (cache *RedisCache) ZScore(key, member string) (interface{}, error)
Click to show internal directories.
Click to hide internal directories.