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
Click to show internal directories.
Click to hide internal directories.