Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Lock ¶
type Lock interface { // Lock try get a lock for given key Lock(ctx context.Context, key string) (observer LockResult, acquired bool) // Release remove lock for given key Release(ctx context.Context, key string) // NotifyAndRelease remove lock for given key and notify all clients waiting for result NotifyAndRelease(ctx context.Context, key string, res *response.Response) }
Lock is responding for collapsing request for same object
type LockResult ¶
type LockResult struct { ResponseChan chan *response.Response // channel on which you get response Cancel chan bool // channel for notify about cancel of waiting Error error // error when creating error }
LockResult contain struct
type MemoryLock ¶
type MemoryLock struct {
// contains filtered or unexported fields
}
MemoryLock is in memory lock for single mort instance
func NewMemoryLock ¶
func NewMemoryLock() *MemoryLock
NewMemoryLock create a new empty instance of MemoryLock
func (*MemoryLock) Lock ¶
func (m *MemoryLock) Lock(_ context.Context, key string) (LockResult, bool)
Lock create unique entry in memory map
func (*MemoryLock) NotifyAndRelease ¶
func (m *MemoryLock) NotifyAndRelease(_ context.Context, key string, originalResponse *response.Response)
NotifyAndRelease tries notify all waiting goroutines about response
type NopLock ¶
type NopLock struct { }
NopLock will never collapse any request
func (*NopLock) NotifyAndRelease ¶
NotifyAndRelease do nothing
type RedisLock ¶ added in v0.18.0
type RedisLock struct { LockTimeout int // contains filtered or unexported fields }
RedisLock is in Redis lock for single mort instance
func NewRedisCluster ¶ added in v0.18.0
func NewRedisLock ¶ added in v0.18.0
NewRedis create connection to redis and update it config from clientConfig map
Click to show internal directories.
Click to hide internal directories.