Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MemoryStorage ¶
type MemoryStorage struct {
// contains filtered or unexported fields
}
MemoryStorage is an in-memory rate limit storage implementation
func NewMemoryStorage ¶
func NewMemoryStorage() *MemoryStorage
type RedisStorage ¶
type RedisStorage struct {
// contains filtered or unexported fields
}
RedisStorage implements rl.Storage using Redis counters with windowed expiry.
func NewRedisStorage ¶
func NewRedisStorage(client *redis.Client) *RedisStorage
NewRedisStorage creates a new RedisStorage.
func (*RedisStorage) Increment ¶
func (s *RedisStorage) Increment(ctx context.Context, key string, window time.Duration) (int, error)
Increment increases the counter for key within the given window and returns the current value. If the key is new or has no expiry, it sets the expiry to the window duration.
Click to show internal directories.
Click to hide internal directories.