All Projects → gojekfarm → go-ratelimit

gojekfarm / go-ratelimit

Licence: other
Ratelimit your methods using Redis

Programming Languages

go
31211 projects - #10 most used programming language
Makefile
30231 projects

Projects that are alternatives of or similar to go-ratelimit

adaptive throttler
manages multiple throttlers with ability to ramp up and down
Stars: ✭ 31 (-16.22%)
Mutual labels:  rate-limits, rate-limiting
Abp.AspNetCoreRateLimit
An Abp module helps you control how often your service is used.
Stars: ✭ 19 (-48.65%)
Mutual labels:  rate-limits, rate-limiting
gatekeeper
Rate limiting middleware for Vapor 👮
Stars: ✭ 54 (+45.95%)
Mutual labels:  rate-limits, rate-limiting
servicestack-ratelimit-redis
A rate limiting plugin for ServiceStack that uses Redis for calculating and persisting request counts
Stars: ✭ 16 (-56.76%)
Mutual labels:  rate-limits
flume
A blazing fast job processing system backed by GenStage & Redis.
Stars: ✭ 37 (+0%)
Mutual labels:  rate-limiting
phalcon-throttler
Phalcon Throttler is a Rate Limiter for the PHP Phalcon Framework.
Stars: ✭ 19 (-48.65%)
Mutual labels:  rate-limiting
Spring-Boot-Application-Template
Spring Boot Web App, Flyway, MySQL, H2DB, Bootstrap, Thymeleaf, JWT, Swagger, API Rate Limiting, Docker, RBAC, i18n
Stars: ✭ 90 (+143.24%)
Mutual labels:  rate-limiting
flaps
🛬 Modular rate limiting for PHP.
Stars: ✭ 64 (+72.97%)
Mutual labels:  rate-limiting
koa-simple-ratelimit
Simple rate limiter for Koa.js v2 web framework
Stars: ✭ 17 (-54.05%)
Mutual labels:  rate-limits
resque-waiting-room
Resque plugin that throttles your jobs
Stars: ✭ 34 (-8.11%)
Mutual labels:  rate-limiting
EnumerableAsyncProcessor
Process Multiple Asynchronous Tasks in Various Ways - One at a time / Batched / Rate limited / Concurrently
Stars: ✭ 84 (+127.03%)
Mutual labels:  rate-limiting
zlimiter
A toolkit for rate limite,support memory and redis
Stars: ✭ 17 (-54.05%)
Mutual labels:  rate-limiting
ratelimiter
A concurrent rate limiter library for Golang based on Sliding-Window rate limiter algorithm.
Stars: ✭ 218 (+489.19%)
Mutual labels:  rate-limiting
gcra-ruby
Generic cell rate algorithm (leaky bucket) implementation for rate limiting
Stars: ✭ 49 (+32.43%)
Mutual labels:  rate-limiting
limits
Rate limiting using various strategies and storage backends such as redis & memcached
Stars: ✭ 178 (+381.08%)
Mutual labels:  rate-limiting
rush
rush.readthedocs.io/en/latest/
Stars: ✭ 42 (+13.51%)
Mutual labels:  rate-limiting
flood-protection
Flood protection for realtime applications
Stars: ✭ 19 (-48.65%)
Mutual labels:  rate-limiting
p-ratelimit
Promise-based utility to make sure you don’t call rate-limited APIs too quickly.
Stars: ✭ 49 (+32.43%)
Mutual labels:  rate-limiting
RateLimiting.NET
Rate Limiting (debounce, throttle) for C# Portable Class Library
Stars: ✭ 20 (-45.95%)
Mutual labels:  rate-limiting
db wlan manager
Monitors your Wifi to keep you logged in and resets your Wifi, if your data is drained
Stars: ✭ 23 (-37.84%)
Mutual labels:  rate-limiting

Build Status

ratelimit

-- import "go-ratelimit/ratelimit"

Usage

type RateLimitConfig

type RateLimitConfig struct {
	Attempts          int
	WindowInSeconds   int
	CooldownInSeconds int
}

RateLimitConfig type for setting rate limiting params

func NewRateLimitConfig

func NewRateLimitConfig(attempts, windowInSeconds, cooldownInSeconds int) *RateLimitConfig

NewRateLimitConfig to create a new config for rate limiting

var ErrBlocked = errors.New("rate limit: blocked")

ErrBlocked is returned when an attribute is rate limited

type RateLimit

type RateLimit struct {
}

RateLimit type for ratelimiting

func NewRateLimit

func NewRateLimit(redisPool *redis.Pool, config *config.RateLimitConfig) *RateLimit

NewRateLimit func to create a new rate limiting type

func (*RateLimit) RateLimitExceeded

func (rl *RateLimit) RateLimitExceeded(key string) bool

RateLimitExceeded returns state of a RateLimit for a key given

func (*RateLimit) Reset

func (rl *RateLimit) Reset(key string) error

Reset func clears the key from rate limiting

func (*RateLimit) Run

func (rl *RateLimit) Run(key string) error

Run initiates ratelimiting for the key given

type RateLimiter

type RateLimiter interface {
	Run(key string) error
	RateLimitExceeded(key string) bool
	Reset(key string) error
}

RateLimiter interface for rate limiting key

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].