Documentation ¶
Index ¶
- func ExistsKey(redisCli *redis.Client, key string) (bool, error)
- func InitByConfigList(redisClientList []optredisconfig.Cfg) error
- func RedisScanKeysMatch(redisCli *redis.Client, match string, maxCount int64) ([]string, error)
- type Config
- type ConfigOption
- type OptRedis
- func (o OptRedis) Client() *redis.Client
- func (o OptRedis) Del(key string, prefix string) (int64, error)
- func (o OptRedis) Exists(key string, prefix string) (bool, error)
- func (o OptRedis) Expire(key string, prefix string, exp time.Duration) (bool, error)
- func (o OptRedis) GetJson(key string, prefix string, v interface{}) error
- func (o OptRedis) InitByName() OptRedis
- func (o OptRedis) Persist(key string, prefix string) (bool, error)
- func (o OptRedis) Ping() (OptRedis, error)
- func (o OptRedis) SetJson(key string, prefix string, data interface{}, expiration time.Duration) error
- func (o OptRedis) TTL(key string, prefix string) (time.Duration, error)
- type RedisFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitByConfigList ¶
func InitByConfigList(redisClientList []optredisconfig.Cfg) error
init by viper config list as
redis_clients: - name: default addr: localhost:6379 password: db: 0 max_retries: 0 # Default is to not retry failed commands dial_timeout: 5 # Default is 5 seconds. read_timeout: 3 # Default is 3 seconds. write_timeout: 3 # Default is ReadTimeout
Types ¶
type Config ¶
func NewConfig ¶
func NewConfig(opts ...ConfigOption) (opt *Config)
func NewConfigFull ¶
func NewConfigFull() *Config
type ConfigOption ¶
type ConfigOption func(*Config)
func WithName ¶
func WithName(name string) ConfigOption
func WithUseBloomFilter ¶
func WithUseBloomFilter(useBloomFilter bool) ConfigOption
func WithUseBloomK ¶
func WithUseBloomK(bloomK uint) ConfigOption
func WithUseBloomM ¶
func WithUseBloomM(bloomM uint) ConfigOption
func WithUseBloomN ¶
func WithUseBloomN(bloomN uint) ConfigOption
type OptRedis ¶
type OptRedis struct { Name string UseBoomFilter bool BloomK uint BloomN uint BloomM uint RedisClient *redis.Client BloomFilter *bloom.BloomFilter // contains filtered or unexported fields }
func (OptRedis) InitByName ¶
type RedisFunc ¶
type RedisFunc interface { InitByName() OptRedis Ping() (OptRedis, error) Client() *redis.Client Exists(key string, prefix string) (bool, error) Del(key string, prefix string) (int64, error) TTL(key string, prefix string) (time.Duration, error) Expire(key string, prefix string, exp time.Duration) (bool, error) Persist(key string, prefix string) (bool, error) SetJson(key string, prefix string, data interface{}, expiration time.Duration) error GetJson(key string, prefix string, v interface{}) error }
func NewOptRedis ¶
Click to show internal directories.
Click to hide internal directories.