throttle

package
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 5, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultExpiration = time.Minute

Functions

This section is empty.

Types

type RefCounter

type RefCounter struct {
	// contains filtered or unexported fields
}

RefCounter allows to throttle based on reference counter.

func NewRefCounter

func NewRefCounter(client *redis.Client, quota int64) *RefCounter

func (*RefCounter) Ref

func (rc *RefCounter) Ref(key string, expiration ...time.Duration) bool

func (*RefCounter) SafeUnref

func (rc *RefCounter) SafeUnref(key string)

func (*RefCounter) UnrefAsync

func (rc *RefCounter) UnrefAsync(key string)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL