Documentation ¶
Index ¶
Constants ¶
View Source
const ( UnLockScript string = ` if redis.call('GET', KEYS[1]) == ARGV[1] then return redis.call('DEL', KEYS[1]) else return 0 end ` KeepLockScript string = ` if redis.call('GET', KEYS[1]) == ARGV[1] then return redis.call('PEXPIRE', KEYS[1], ARGV[2]) else return 0 end ` )
Variables ¶
This section is empty.
Functions ¶
func GetRedisPool ¶
func GetRedisPool(conf *gofkConf.RedisConfig) *redis.Pool
func GetRedisPoolMq ¶
func GetRedisPoolMq(conf *gofkConf.RedisConfig) *redis.Pool
func Incrementing ¶
Types ¶
type LockOptionFunc ¶
type LockOptionFunc func(option *lockOption)
func WithLockTTL ¶
func WithLockTTL(lt time.Duration) LockOptionFunc
func WithRedisConf ¶
func WithRedisConf(conf *gofkConf.RedisConfig) LockOptionFunc
func WithRedisPool ¶
func WithRedisPool(pool *redis.Pool) LockOptionFunc
func WithWaitCAS ¶
func WithWaitCAS(wt time.Duration) LockOptionFunc
type LockerInter ¶
type LockerInter interface { SetKey(string) LockerInter Lock() error UnLock() (bool, error) WaitCAS() error }
func NewLock ¶
func NewLock(conf *gofkConf.RedisConfig, opts ...LockOptionFunc) LockerInter
Click to show internal directories.
Click to hide internal directories.