store

package
v0.0.0-...-32f922e Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2024 License: MIT-0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultRateLimiterMemoryStoreConfig = RateLimiterPersistentStoreConfig{
	ExpiresIn: 3 * time.Minute,
}

DefaultRateLimiterMemoryStoreConfig provides default configuration values for RateLimiterMemoryStore

Functions

This section is empty.

Types

type RateLimiterPersistentStore

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

func NewRateLimiterPersistentStoreWithConfig

func NewRateLimiterPersistentStoreWithConfig(config RateLimiterPersistentStoreConfig) (store *RateLimiterPersistentStore)

func (*RateLimiterPersistentStore) Allow

func (store *RateLimiterPersistentStore) Allow(identifier string) (bool, error)

type RateLimiterPersistentStoreConfig

type RateLimiterPersistentStoreConfig struct {
	Rate      rate.Limit    // Rate of requests allowed to pass as req/s. For more info check out Limiter docs - https://pkg.go.dev/golang.org/x/time/rate#Limit.
	Burst     int           // Burst is maximum number of requests to pass at the same moment. It additionally allows a number of requests to pass when rate limit is reached.
	ExpiresIn time.Duration // ExpiresIn is the duration after that a rate limiter is cleaned up
}

RateLimiterPersistentStoreConfig represents configuration for RateLimiterMemoryStore

type Visitor

type Visitor struct {
	*rate.Limiter
	// contains filtered or unexported fields
}

Visitor signifies a unique user's limiter details

Jump to

Keyboard shortcuts

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