Documentation
¶
Index ¶
- func BloomCmd() *cmdBloom
- func HashCmd() *cmdHash
- func KeyCmd() *cmdKey
- func ListCmd() *cmdList
- func LockWithDeadline(ctx context.Context, key RedisKey, retryDeadline time.Time, retryInterval int, ...) (error, <-chan struct{})
- func LockWithMaxRetry(ctx context.Context, key RedisKey, retryMax, retryInterval int, ...) (error, <-chan struct{})
- func RawLockerClient() *redislock.Client
- func RawRedisClient() redis.UniversalClient
- func SetCmd() *cmdSet
- func SortedSetCmd() *cmdSortedSet
- func StringCmd() *cmdString
- func TopicCmd() *cmdTopic
- func TryLock(key RedisKey, executable func(), keyAppend ...interface{}) (error, <-chan struct{})
- func TryLockWithContext(ctx context.Context, key RedisKey, executable func(), keyAppend ...interface{}) (error, <-chan struct{})
- type BloomInfo
- type Locker
- type RedisConfig
- type RedisKey
- type RedisStarter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LockWithDeadline ¶
func LockWithDeadline(ctx context.Context, key RedisKey, retryDeadline time.Time, retryInterval int, executable func(), keyAppend ...interface{}) (error, <-chan struct{})
LockWithDeadline 持续尝试获取锁 request lockTtl 获得锁之后的持续时长(超时自动释放)
retryDeadline 重试持续时间 retryInterval 重试间隔(millisecond)
func LockWithMaxRetry ¶
func LockWithMaxRetry(ctx context.Context, key RedisKey, retryMax, retryInterval int, executable func(), keyAppend ...interface{}) (error, <-chan struct{})
LockWithMaxRetry 持续尝试获取锁 request lockTtl 获得锁之后的持续时长(超时自动释放)
retryMax 尝试获取锁最大重试次数 intervalMil 重试间隔(millisecond)
func RawLockerClient ¶
RawLockerClient 获取原始RedisLockerClient进行操作
func RawRedisClient ¶
func RawRedisClient() redis.UniversalClient
RawRedisClient 获取原始RedisClient进行操作
func SortedSetCmd ¶ added in v0.1.4
func SortedSetCmd() *cmdSortedSet
Types ¶
type Locker ¶ added in v0.1.6
type Locker struct {
// contains filtered or unexported fields
}
func TryAndGetLocker ¶ added in v0.1.6
TryAndGetLocker 尝试获取锁并返回Locker
type RedisConfig ¶ added in v0.1.9
type RedisConfig struct { redis.UniversalOptions InitFunc func(instance redis.UniversalClient) }
type RedisKey ¶
type RedisKey struct { // 最终key值的格式化格式 将使用 fmt.Sprintf(key.KeyFormat, keyAppend) 进行处理 KeyFormat string // Key 过期时间(如果可以设置) 当该RedisKey作用与Locker时,该时间指明了自动释放锁时间 如果为零值则会立即失败 Expire time.Duration }
func NewRedisKey ¶ added in v0.1.4
NewRedisKey 创建一个RedisKey keyFormat 最终key值的格式化格式 将使用 fmt.Sprintf(key.KeyFormat, keyAppend) 进行处理
func (RedisKey) RawKeyString ¶ added in v0.1.9
RawKeyString 获取原始key字符串
type RedisStarter ¶
type RedisStarter struct { Config RedisConfig LazyConfig func() RedisConfig RedisSetting *parent.Setting // contains filtered or unexported fields }
func (*RedisStarter) Setting ¶
func (r *RedisStarter) Setting() *parent.Setting
func (*RedisStarter) Start ¶
func (r *RedisStarter) Start() (interface{}, error)
Click to show internal directories.
Click to hide internal directories.