Documentation
¶
Index ¶
- func NewStore(client Client) (limiter.Store, error)
- func NewStoreWithOptions(client Client, options limiter.StoreOptions) (limiter.Store, error)
- type Client
- 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 NewStoreWithOptions ¶
NewStoreWithOptions returns an instance of redis store with options.
Types ¶
type Client ¶
type Client interface {
Ping() *libredis.StatusCmd
Get(key string) *libredis.StringCmd
Set(key string, value interface{}, expiration time.Duration) *libredis.StatusCmd
Watch(handler func(*libredis.Tx) error, keys ...string) error
Del(keys ...string) *libredis.IntCmd
SetNX(key string, value interface{}, expiration time.Duration) *libredis.BoolCmd
Eval(script string, keys []string, args ...interface{}) *libredis.Cmd
}
Client is an interface thats allows to use a redis cluster or a redis single client seamlessly.
type Store ¶
type Store struct {
// Prefix used for the key.
Prefix string
// MaxRetry is the maximum number of retry under race conditions.
MaxRetry int
// contains filtered or unexported fields
}
Store is the redis 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.