Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶ added in v0.2.0
type Config[V any] struct { Local[V] Distributed[V] }
type Debouncer ¶
type Debouncer[V any] struct { // contains filtered or unexported fields }
Debouncer represents distributed suppressor duplicated calls.
func NewDebouncer ¶
NewDebouncer returns new instance of Debouncer.
func (*Debouncer[V]) Do ¶
Do executes and returns the results of the given function, making sure that only one execution is in-flight for a given key at a time. If a duplicate comes in from same instance, the duplicate caller waits for the original to complete and receives the same results. The return a channel that will receive the results when they are ready.
type Distributed ¶ added in v0.2.0
type Distributed[V any] struct { Locker adapters.LockFactory Cache adapters.Cache Retry time.Duration TTL time.Duration Serializer Serializer[V] }
type DistributedGroup ¶
type DistributedGroup[V any] struct { // contains filtered or unexported fields }
DistributedGroup suppress duplicated calls.
func (*DistributedGroup[V]) Do ¶
func (g *DistributedGroup[V]) Do(key string, closure Closure[V]) (V, error)
Do executes and returns the results of the given function, making sure that only one execution is in-flight for a given key at a time. If a duplicate comes in from intances, the duplicate caller waits for the only once instance to complete and receives the same results. The return a channel that will receive the results when they are ready.
type Local ¶ added in v0.2.0
type Local[V any] struct { TTL time.Duration Cache suppressor.Cache[string, suppressor.Result[V]] }