Documentation ¶
Index ¶
- Variables
- func DLock(c context.Context, lockKey, requestId string) (releaseLock func(), err error)
- func ReleaseDistributedLock(c context.Context, lockKey, requestId string) (bool, error)
- func TryGetDistributedLock(c context.Context, lockKey, requestId string, isNegative bool) bool
- type DefaultHook
- func (DefaultHook) AfterProcess(ctx entity.Context, cmd redis.Cmder) error
- func (DefaultHook) AfterProcessPipeline(ctx entity.Context, cmds []redis.Cmder) error
- func (DefaultHook) BeforeProcess(ctx entity.Context, cmd redis.Cmder) (entity.Context, error)
- func (DefaultHook) BeforeProcessPipeline(ctx entity.Context, cmds []redis.Cmder) (entity.Context, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ConfigDSN config dsn description ConfigDSN = "./conf/app.yaml" // RedisSection redis RedisSection = "redis" )
Functions ¶
func ReleaseDistributedLock ¶
ReleaseDistributedLock 释放锁,通过比较requestId,用于确保只释放自己的锁,使用lua脚本保证操作的原子型
Types ¶
type DefaultHook ¶
type DefaultHook struct{}
1: log 2: trace todo 3: metrics todo
func (DefaultHook) AfterProcess ¶
func (DefaultHook) AfterProcess(ctx entity.Context, cmd redis.Cmder) error
AfterProcess 后回调
func (DefaultHook) AfterProcessPipeline ¶
func (DefaultHook) AfterProcessPipeline(ctx entity.Context, cmds []redis.Cmder) error
AfterProcessPipeline 后pipeline
func (DefaultHook) BeforeProcess ¶
BeforeProcess 前回调
func (DefaultHook) BeforeProcessPipeline ¶
func (DefaultHook) BeforeProcessPipeline(ctx entity.Context, cmds []redis.Cmder) (entity.Context, error)
BeforeProcessPipeline 前pipeline
Click to show internal directories.
Click to hide internal directories.