astilimiter

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2018 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bucket

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

Bucket represents a bucket

func (*Bucket) Inc

func (b *Bucket) Inc() bool

Inc increments the bucket count

type Limiter

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

Limiter represents a limiter

func New

func New() *Limiter

New creates a new limiter

func (*Limiter) Add

func (l *Limiter) Add(name string, cap int, period time.Duration) *Bucket

Add adds a new bucket

func (*Limiter) Bucket

func (l *Limiter) Bucket(name string) (b *Bucket, ok bool)

Bucket retrieves a bucket from the limiter

Jump to

Keyboard shortcuts

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