Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CacheDriver ¶
type CacheDriver int
const ( // Memcached indicates use Memcached like distributed cache and locker. Memcached CacheDriver = iota // Redis indicates use Redis like distributed cache and locker. Redis )
type Debouncer ¶
type Debouncer struct {
// contains filtered or unexported fields
}
Debouncer represents distributed suppressor duplicated calls.
func NewDebouncer ¶
func NewDebouncer( impl CacheDriver, dsn string, localCacheTTL, distributedCacheTTL time.Duration, ) (*Debouncer, error)
NewDebouncer returns new instance of Debouncer.
func (*Debouncer) 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 DistributedGroup ¶
type DistributedGroup struct {
// contains filtered or unexported fields
}
DistributedGroup suppress duplicated calls.
func (*DistributedGroup) Do ¶
func (g *DistributedGroup) Do(key string, duration time.Duration, closure Closure) (interface{}, 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.