Documentation ¶
Index ¶
Constants ¶
const OptionName = `redigostore`
OptionName identifies this package within the register of the backendratelimit.Backend type.
Variables ¶
This section is empty.
Functions ¶
func NewOptionFactory ¶
func NewOptionFactory(burst, requests cfgmodel.Int, duration cfgmodel.Str, redisURL cfgmodel.Str) (string, ratelimit.OptionFactoryFunc)
NewOptionFactory creates a new option factory function for the memstore in the backend package to be used for automatic scope based configuration initialization. Configuration values are read from argument `be`.
func WithGCRA ¶
func WithGCRA(redisRawURL string, duration rune, requests, burst int, scopeIDs ...scope.TypeID) ratelimit.Option
WithGCRA creates a new Redis-based store, using the provided pool to get its connections. The keys will have the specified keyPrefix, which may be an empty string, and the database index specified by db will be selected to store the keys. Any updating operations will reset the key TTL to the provided value rounded down to the nearest second. Depends on Redis 2.6+ for EVAL support.
URLs should follow the draft IANA specification for the scheme (https://www.iana.org/assignments/uri-schemes/prov/redis).
For example:
redis://localhost:6379/3 redis://:6380/0 => connects to localhost:6380 redis:// => connects to localhost:6379 with DB 0 redis://empty:myPassword@clusterName.xxxxxx.0001.usw2.cache.amazonaws.com:6379/0
GCRA => https://en.wikipedia.org/wiki/Generic_cell_rate_algorithm This function implements a debug log.
Types ¶
This section is empty.