limap

package module
v0.0.0-...-2df037f Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2019 License: MIT Imports: 5 Imported by: 0

README

Limap

No frills utility map for rate limiter.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Limap

type Limap struct {
	Expiry           time.Duration
	SweepingInterval time.Duration
	Rate             int
	Burst            int

	StopBGSweeper context.CancelFunc
	// contains filtered or unexported fields
}

func New

func New(rate, burst int, expiry time.Duration, initSize int, sweepingInterval time.Duration) (m *Limap)

func (*Limap) Del

func (m *Limap) Del(key []byte)

func (*Limap) IsAllowed

func (m *Limap) IsAllowed(key []byte) (allowed, ok bool)

func (*Limap) RunBGSweeper

func (m *Limap) RunBGSweeper(ctx context.Context)

func (*Limap) Set

func (m *Limap) Set(key []byte)

Jump to

Keyboard shortcuts

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