Documentation
¶
Overview ¶
Package redis tool
Package redis ¶
Package redis ¶
Package redis
Index ¶
- func SimpleDel()
- func SimpleDelAll()
- func SimpleExists()
- func SimpleGet()
- func SimpleGetLock()
- func SimpleNewRedis()
- func SimpleQuotaLimit()
- func SimpleReadStreamsAndAck()
- func SimpleReadStreamsAndAck2()
- func SimpleRegister()
- func SimpleSet()
- func SimpleSetEx()
- func SimpleStreamAdd()
- func SimpleUnlink()
- func SimpleWithLock()
- func SimpleZAdd()
- func SimpleZRangeByScore()
- func SimpleZRem()
- type Options
- type Redis
- func (r *Redis) BitCount(ctx context.Context, key string, bitStart, bitEnd int64) (int64, error)
- func (r *Redis) BitCountAll(ctx context.Context, key string) (int64, error)
- func (r *Redis) BitField(ctx context.Context, key string, args ...interface{}) ([]int64, error)
- func (r *Redis) BitOpAnd(ctx context.Context, destKey string, keys ...string) (int64, error)
- func (r *Redis) BitOpNot(ctx context.Context, destKey string, key string) (int64, error)
- func (r *Redis) BitOpOr(ctx context.Context, destKey string, keys ...string) (int64, error)
- func (r *Redis) BitOpXor(ctx context.Context, destKey string, keys ...string) (int64, error)
- func (r *Redis) BitPos(ctx context.Context, key string, bit int64, pos ...int64) (int64, error)
- func (r *Redis) Close() error
- func (r *Redis) Del(ctx context.Context, key ...string) (int64, error)
- func (r *Redis) Exists(ctx context.Context, key ...string) (int64, error)
- func (r *Redis) FreeLock(key string) error
- func (r *Redis) Get(ctx context.Context, key string) (string, error)
- func (r *Redis) GetBit(ctx context.Context, key string, offset int64) (int64, error)
- func (r *Redis) GetLock(key string, lockVal *string, exp int) error
- func (r *Redis) HScan(ctx context.Context, key string, cursor uint64, match string, count int64) (keys []string, cur uint64, err error)
- func (r *Redis) PTTL(ctx context.Context, key string) (int64, error)
- func (r *Redis) Ping(ctx context.Context) string
- func (r *Redis) QuotaLimit(limitKay string, maxCount int, exp int, addCount int, addLock bool) bool
- func (r *Redis) Raw() (*v8.Client, context.Context)
- func (r *Redis) RawCtx() context.Context
- func (r *Redis) RawRedis() *v8.Client
- func (r *Redis) Register(key string, val string, exp int) bool
- func (r *Redis) SAdd(ctx context.Context, key string, members ...interface{}) (int64, error)
- func (r *Redis) SCard(ctx context.Context, key string) (int64, error)
- func (r *Redis) SDiff(ctx context.Context, keys ...string) ([]string, error)
- func (r *Redis) SDiffStore(ctx context.Context, destination string, keys ...string) (int64, error)
- func (r *Redis) SInter(ctx context.Context, keys ...string) ([]string, error)
- func (r *Redis) SInterStore(ctx context.Context, destination string, keys ...string) (int64, error)
- func (r *Redis) SIsMember(ctx context.Context, key string, member interface{}) (bool, error)
- func (r *Redis) SMIsMember(ctx context.Context, key string, members ...interface{}) ([]bool, error)
- func (r *Redis) SMembers(ctx context.Context, key string) ([]string, error)
- func (r *Redis) SMembersMap(ctx context.Context, key string) (map[string]struct{}, error)
- func (r *Redis) SMove(ctx context.Context, source, destination string, member interface{}) (bool, error)
- func (r *Redis) SPop(ctx context.Context, key string) (string, error)
- func (r *Redis) SPopN(ctx context.Context, key string, count int64) ([]string, error)
- func (r *Redis) SRandMember(ctx context.Context, key string) (string, error)
- func (r *Redis) SRandMemberN(ctx context.Context, key string, count int64) ([]string, error)
- func (r *Redis) SRem(ctx context.Context, key string, members ...interface{}) (int64, error)
- func (r *Redis) SScan(ctx context.Context, key string, cursor uint64, match string, count int64) (keys []string, cur uint64, err error)
- func (r *Redis) SUnion(ctx context.Context, keys ...string) ([]string, error)
- func (r *Redis) SUnionStore(ctx context.Context, destination string, keys ...string) (int64, error)
- func (r *Redis) Scan(ctx context.Context, cursor uint64, match string, count int64) (keys []string, cur uint64, err error)
- func (r *Redis) ScanType(ctx context.Context, cursor uint64, match string, count int64, keyType string) (keys []string, cur uint64, err error)
- func (r *Redis) Set(ctx context.Context, key, val string) error
- func (r *Redis) SetBit(ctx context.Context, key string, offset int64, value int) (int64, error)
- func (r *Redis) SetEx(ctx context.Context, key, val string, expSecond int) error
- func (r *Redis) SetNx(ctx context.Context, key, val string) (bool, error)
- func (r *Redis) SetNxMs(ctx context.Context, key, val string, expMill int) (bool, error)
- func (r *Redis) SetNxSec(ctx context.Context, key, val string, expSecond int) (bool, error)
- func (r *Redis) SetRange(ctx context.Context, key string, offset int64, value string) (int64, error)
- func (r *Redis) SetXx(ctx context.Context, key, val string) (bool, error)
- func (r *Redis) SetXxMs(ctx context.Context, key, val string, expMill int) (bool, error)
- func (r *Redis) SetXxSec(ctx context.Context, key, val string, expSecond int) (bool, error)
- func (r *Redis) StrLen(ctx context.Context, key string) (int64, error)
- func (r *Redis) TTL(ctx context.Context, key string) (int64, error)
- func (r *Redis) TryLock(key string, lockVal *string, exp int, maxTryTime int, intervalMs int64) error
- func (r *Redis) Unlink(ctx context.Context, key ...string) (int64, error)
- func (r *Redis) WithLock(key string, lockVal *string, exp int, maxTryTime int, intervalMs int64, ...)
- func (r *Redis) ZAdd(ctx context.Context, key string, member interface{}, score float64) (int64, error)
- func (r *Redis) ZAddList(ctx context.Context, key string, memList ...map[string]interface{}) (int64, error)
- func (r *Redis) ZRangeByScore(ctx context.Context, key, min, max string, offset, count int64) ([]string, error)
- func (r *Redis) ZRem(ctx context.Context, key string, memberList ...interface{}) (int64, error)
- func (r *Redis) ZRemRangeByScore(ctx context.Context, key, min, max string) (int64, error)
- func (r *Redis) ZScan(ctx context.Context, key string, cursor uint64, match string, count int64) (keys []string, cur uint64, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SimpleDelAll ¶
func SimpleDelAll()
func SimpleExists ¶
func SimpleExists()
func SimpleGetLock ¶
func SimpleGetLock()
func SimpleNewRedis ¶
func SimpleNewRedis()
func SimpleQuotaLimit ¶
func SimpleQuotaLimit()
func SimpleReadStreamsAndAck ¶
func SimpleReadStreamsAndAck()
func SimpleReadStreamsAndAck2 ¶
func SimpleReadStreamsAndAck2()
func SimpleRegister ¶
func SimpleRegister()
func SimpleSetEx ¶
func SimpleSetEx()
func SimpleStreamAdd ¶
func SimpleStreamAdd()
func SimpleUnlink ¶
func SimpleUnlink()
func SimpleWithLock ¶
func SimpleWithLock()
func SimpleZAdd ¶
func SimpleZAdd()
func SimpleZRangeByScore ¶
func SimpleZRangeByScore()
func SimpleZRem ¶
func SimpleZRem()
Types ¶
type Options ¶
func DefaultOptions ¶
func DefaultOptions() Options
func NewOptions ¶
func NewOptions() *Options
type Redis ¶
type Redis struct {
// contains filtered or unexported fields
}
func (*Redis) BitCountAll ¶
func (*Redis) QuotaLimit ¶
QuotaLimit 资源量限制,被限制返回true,否则返回false
func (*Redis) SDiffStore ¶
func (*Redis) SInterStore ¶
func (*Redis) SMIsMember ¶
func (*Redis) SMembersMap ¶
func (*Redis) SRandMember ¶
func (*Redis) SRandMemberN ¶
func (*Redis) SUnionStore ¶
func (*Redis) TryLock ¶
func (r *Redis) TryLock(key string, lockVal *string, exp int, maxTryTime int, intervalMs int64) error
TryLock 尝试获取redis锁,指定重试次数和重试间隔,成功返回nil,否则返回对应error
func (*Redis) WithLock ¶
func (r *Redis) WithLock(key string, lockVal *string, exp int, maxTryTime int, intervalMs int64, fun func())
WithLock 尝试获取redis锁,指定重试次数和重试间隔,获取成功之后执行 fun,否则不执行
func (*Redis) ZAdd ¶
func (r *Redis) ZAdd(ctx context.Context, key string, member interface{}, score float64) (int64, error)
zset funcs
func (*Redis) ZAddList ¶
func (r *Redis) ZAddList(ctx context.Context, key string, memList ...map[string]interface{}) (int64, error)
ZAddList memList: {member: m1, score: 1}
func (*Redis) ZRangeByScore ¶
func (*Redis) ZRemRangeByScore ¶
Click to show internal directories.
Click to hide internal directories.