Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChanResourceLimiter ¶ added in v0.5.7
type ChanResourceLimiter struct {
// contains filtered or unexported fields
}
func NewChanResourcePool ¶ added in v0.5.7
func NewChanResourcePool(cap int) *ChanResourceLimiter
NewChanResourcePool ...
func (*ChanResourceLimiter) Acquire ¶ added in v0.5.7
func (this *ChanResourceLimiter) Acquire() interface{}
func (*ChanResourceLimiter) Release ¶ added in v0.5.7
func (this *ChanResourceLimiter) Release(resource interface{})
type ChanSemaphore ¶
type ChanSemaphore struct {
// contains filtered or unexported fields
}
Semaphore 限制同一时刻,最多可以发生的次数
func (*ChanSemaphore) Acquire ¶
func (this *ChanSemaphore) Acquire()
func (*ChanSemaphore) Release ¶
func (this *ChanSemaphore) Release()
type MutexLimiter ¶ added in v0.5.6
type MutexLimiter struct {
// contains filtered or unexported fields
}
func NewMutexLimiter ¶ added in v0.5.6
func NewMutexLimiter(ttl time.Duration, limit int) *MutexLimiter
func (*MutexLimiter) Acquire ¶ added in v0.5.6
func (l *MutexLimiter) Acquire()
type ResourceLimiter ¶ added in v0.5.7
type ResourceLimiter interface { Acquire() interface{} Release(resource interface{}) }
type SleepLimiter ¶
SleepLimiter 限制单位时间内的可执行次数
func NewSleepLimiter ¶
func NewSleepLimiter(ttl time.Duration, limit int) *SleepLimiter
func (*SleepLimiter) Acquire ¶
func (this *SleepLimiter) Acquire()
Click to show internal directories.
Click to hide internal directories.