vikunja-api/vendor/github.com/ulule/limiter/v3/store.go

29 lines
813 B
Go
Raw Permalink Normal View History

2019-07-21 23:27:30 +02:00
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
}