Documentation ¶
Index ¶
- func NewStore() limiter.Store
- func NewStoreWithOptions(options limiter.StoreOptions) limiter.Store
- type Cache
- type CacheWrapper
- type Counter
- type Store
- func (store *Store) Get(ctx context.Context, key string, rate limiter.Rate) (limiter.Context, error)
- func (store *Store) Peek(ctx context.Context, key string, rate limiter.Rate) (limiter.Context, error)
- func (store *Store) Reset(ctx context.Context, key string, rate limiter.Rate) (limiter.Context, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewStore ¶
func NewStore() limiter.Store
NewStore creates a new instance of memory store with defaults.
func NewStoreWithOptions ¶
func NewStoreWithOptions(options limiter.StoreOptions) limiter.Store
NewStoreWithOptions creates a new instance of memory store with options.
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache contains a collection of counters.
type CacheWrapper ¶
type CacheWrapper struct {
*Cache
}
CacheWrapper is used to ensure that the underlying cleaner goroutine used to clean expired keys will not prevent Cache from being garbage collected.
func NewCache ¶
func NewCache(cleanInterval time.Duration) *CacheWrapper
NewCache returns a new cache.
type Store ¶
type Store struct { // Prefix used for the key. Prefix string // contains filtered or unexported fields }
Store is the in-memory store.
func (*Store) Get ¶
func (store *Store) Get(ctx context.Context, key string, rate limiter.Rate) (limiter.Context, error)
Get returns the limit for given identifier.
Click to show internal directories.
Click to hide internal directories.