feature/rate-limit (#91)
This commit is contained in:
28
vendor/github.com/ulule/limiter/v3/store.go
generated
vendored
Normal file
28
vendor/github.com/ulule/limiter/v3/store.go
generated
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
package limiter
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
)
|
||||
|
||||
// Store is the common interface for limiter stores.
|
||||
type Store interface {
|
||||
// Get returns the limit for given identifier.
|
||||
Get(ctx context.Context, key string, rate Rate) (Context, error)
|
||||
// Peek returns the limit for given identifier, without modification on current values.
|
||||
Peek(ctx context.Context, key string, rate Rate) (Context, error)
|
||||
// Reset resets the limit to zero for given identifier.
|
||||
Reset(ctx context.Context, key string, rate Rate) (Context, error)
|
||||
}
|
||||
|
||||
// StoreOptions are options for store.
|
||||
type StoreOptions struct {
|
||||
// Prefix is the prefix to use for the key.
|
||||
Prefix string
|
||||
|
||||
// MaxRetry is the maximum number of retry under race conditions.
|
||||
MaxRetry int
|
||||
|
||||
// CleanUpInterval is the interval for cleanup.
|
||||
CleanUpInterval time.Duration
|
||||
}
|
Reference in New Issue
Block a user