inmem

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type InMemoryLimiter

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

InMemoryLimiter is a ratelimiter that uses an in-memory map to store counters

func NewLimiter

func NewLimiter(opts map[string][]*ratelimit.RateLimitOptions) *InMemoryLimiter

NewLimiter returns a new ratelimiter that uses an in-memory map to store counters

func (*InMemoryLimiter) Debug

func (i *InMemoryLimiter) Debug() map[string]int

Debug Unsafe - returns the counters map for debugging purposes

func (*InMemoryLimiter) Limit

func (i *InMemoryLimiter) Limit(ctx context.Context) error

Limit limits the request based on the method and metadata key

func (*InMemoryLimiter) LimitMethod

func (i *InMemoryLimiter) LimitMethod(ctx context.Context, method string) error

LimitMethod limits the request based on the method and metadata key

Jump to

Keyboard shortcuts

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