Documentation ¶
Index ¶
- Constants
- Variables
- func GetBigBucket(ID int64) int64
- func GetBigKey(key string, ID int64) string
- func GetBigOffset(ID int64) int64
- func GetBucket(userID int64) int64
- func GetKey(key string, ID int64) string
- func GetOffset(ID int64) int64
- func InitClusterRedis(clientName string, opt *redis.ClusterOptions, trace *trace.Cache) error
- func InitRedis(clientName string, opt *redis.Options, trace *trace.Cache) error
- type Cache
- type Redis
- func (r *Redis) BitCountNOBucket(key string, start, end int64) (value int64, err error)
- func (r *Redis) BitOPNOBucket(op, destKey string, keys ...string) (value int64, err error)
- func (r *Redis) Close() error
- func (r *Redis) Delete(key string) error
- func (r *Redis) Exists(keys ...string) (bool, error)
- func (r *Redis) Expire(key string, ttl time.Duration) (bool, error)
- func (r *Redis) ExpireAt(key string, ttl time.Time) (bool, error)
- func (r *Redis) Get(key string) interface{}
- func (r *Redis) GetBigBit(key string, offset int64) (value int64, err error)
- func (r *Redis) GetBit(key string, offset int64) (value int64, err error)
- func (r *Redis) GetBitNOBucket(key string, offset int64) (value int64, err error)
- func (r *Redis) GetStr(key string) (value string, err error)
- func (r *Redis) Incr(key string) (value int64, err error)
- func (r *Redis) IsExist(key string) bool
- func (r *Redis) Set(key string, value interface{}, ttl time.Duration) error
- func (r *Redis) SetBigBit(key string, offset int64, val int) (value int64, err error)
- func (r *Redis) SetBit(key string, offset int64, val int) (value int64, err error)
- func (r *Redis) SetBitNOBucket(key string, offset int64, val int) (value int64, err error)
- func (r *Redis) TTL(key string) (time.Duration, error)
- func (r *Redis) Version() string
Constants ¶
View Source
const ( DefaultRedisClient = "default-redis-client" MinIdleConns = 50 PoolSize = 20 MaxRetries = 3 )
Variables ¶
View Source
var CTXRedis = context.Background()
View Source
var CacheStdLogger stdLogger
Functions ¶
func GetBigOffset ¶
0x7FFF的二进制为111111111111111 与ID做与运算结果保留了ID的低15位
func InitClusterRedis ¶
Types ¶
type Cache ¶
type Cache interface { Set(key string, value interface{}, ttl time.Duration) error Get(key string) interface{} GetStr(key string) (value string, err error) TTL(key string) (time.Duration, error) Expire(key string, ttl time.Duration) (bool, error) ExpireAt(key string, ttl time.Time) (bool, error) Delete(key string) error Exists(keys ...string) (bool, error) IsExist(key string) bool Incr(key string) (int64, error) SetBit(key string, offset int64, val int) (value int64, err error) GetBit(key string, offset int64) (value int64, err error) SetBigBit(key string, offset int64, val int) (value int64, err error) GetBigBit(key string, offset int64) (value int64, err error) SetBitNOBucket(key string, offset int64, val int) (value int64, err error) GetBitNOBucket(key string, offset int64) (value int64, err error) BitCountNOBucket(key string, start, end int64) (value int64, err error) Close() error Version() string }
type Redis ¶
type Redis struct {
// contains filtered or unexported fields
}
func GetRedisClient ¶
func GetRedisClusterClient ¶
func (*Redis) BitCountNOBucket ¶
func (*Redis) BitOPNOBucket ¶
func (*Redis) GetBitNOBucket ¶
func (*Redis) SetBitNOBucket ¶
Click to show internal directories.
Click to hide internal directories.