| 91 | var errInvalidRate = errors.DefineInvalidArgument("invalid_rate", "invalid rate `{rate}` for profile `{name}`") |
| 92 | |
| 93 | func newStore(conf StoreConfig) (store throttled.GCRAStoreCtx, err error) { |
| 94 | switch conf.Provider { |
| 95 | case "redis": |
| 96 | return redisstore.NewCtx(conf.Redis, conf.Redis.Key("")) |
| 97 | |
| 98 | default: |
| 99 | return memstore.NewCtx(int(conf.Memory.MaxSize)) |
| 100 | } |
| 101 | } |
| 102 | |
| 103 | // NewProfile returns a new ratelimit.Interface from profile configuration. |
| 104 | func NewProfile(ctx context.Context, conf config.RateLimitingProfile, storeConf StoreConfig) (Interface, error) { |