ratelimit

package
v2.7.1+incompatible Latest Latest
Warning

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

Go to latest
Published: May 22, 2017 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Registry

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

Registry for rate limiting

func NewRegistry

func NewRegistry(rate int, per time.Duration) *Registry

NewRegistry returns a new Registry for rate limiting

func (*Registry) Limit

func (r *Registry) Limit(id string) bool

Limit returns true if the ratelimit for the given entity has been reached

func (*Registry) Wait

func (r *Registry) Wait(id string) time.Duration

Wait returns the time to wait until available

Jump to

Keyboard shortcuts

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