All Projects → nikolaposa → Rate Limit

nikolaposa / Rate Limit

Licence: mit
🚔 General purpose rate limiter implementation.

Projects that are alternatives of or similar to Rate Limit

Express Security
nodejs + express security and performance boilerplate.
Stars: ✭ 37 (-80.83%)
Mutual labels:  redis, rate-limiting
Redis rate
Rate limiting for go-redis
Stars: ✭ 248 (+28.5%)
Mutual labels:  redis, rate-limiting
Redisratelimiter
Redis Based API Access Rate Limiter
Stars: ✭ 80 (-58.55%)
Mutual labels:  redis, rate-limiting
Redis Ratelimit
A fixed window rate limiter based on Redis
Stars: ✭ 15 (-92.23%)
Mutual labels:  redis, rate-limiting
Speedbump
A Redis-backed rate limiter in Go
Stars: ✭ 107 (-44.56%)
Mutual labels:  redis, rate-limiting
Hospital
医院预约挂号微信小程序(Spring Boot、Vue、Uni-app)
Stars: ✭ 182 (-5.7%)
Mutual labels:  redis
Nest
Generate nested namespaced keys for key-value databases.
Stars: ✭ 188 (-2.59%)
Mutual labels:  redis
Interview Comment
Stars: ✭ 182 (-5.7%)
Mutual labels:  redis
Mage2vuestorefront
Magento to Vue-storefront datapump - synchronizes Products, Categories and Product-to-category links between your Magento2 API and NoSQL database of vue-storefront
Stars: ✭ 183 (-5.18%)
Mutual labels:  redis
Zend Diagnostics
Universal set of diagnostic tests for PHP applications.
Stars: ✭ 192 (-0.52%)
Mutual labels:  redis
Dailyreport
日报管理系统V1版本,适合小团队的每日汇报记录
Stars: ✭ 191 (-1.04%)
Mutual labels:  redis
Springcloud Miaosha
一个基于spring cloud Greenwich的简单秒杀电子商城项目,适合新人阅读。A simple spring cloud based seckill shopping mall project, suitable for young people to read. It can be used as a paper material for academic defense.
Stars: ✭ 187 (-3.11%)
Mutual labels:  redis
Ms
🔥MS 是一个前后分离的分布式 spring cloud 框架(全家桶),这里有统一认证,统一网关等等功能,是一个非常简洁的微服务脚手架
Stars: ✭ 186 (-3.63%)
Mutual labels:  redis
Back End Interview
后端面试题汇总(Python、Redis、MySQL、PostgreSQL、Kafka、数据结构、算法、编程、网络)
Stars: ✭ 188 (-2.59%)
Mutual labels:  redis
Destiny.core.flow
Destiny.Core.Flow是基于.Net Core,VUE前后分离,开发的一个开源Admin管理框架目前有以下模块:菜单管理、用户管理、角色管理、用户角色、角色权限等功能。
Stars: ✭ 184 (-4.66%)
Mutual labels:  redis
Zi5book
book.zi5.me全站kindle电子书籍爬取,按照作者书籍名分类,每本书有mobi和equb两种格式,采用分布式进行全站爬取
Stars: ✭ 191 (-1.04%)
Mutual labels:  redis
Redisc
A Go redis cluster client built on top of redigo.
Stars: ✭ 183 (-5.18%)
Mutual labels:  redis
Springboot Learning
《Spring Boot基础教程》,2.x版本持续连载中!点击下方链接直达教程目录!
Stars: ✭ 13,916 (+7110.36%)
Mutual labels:  redis
Redis4cats
🔖 Redis client built on top of Cats Effect, Fs2 and Lettuce
Stars: ✭ 189 (-2.07%)
Mutual labels:  redis
Lua Resty Redis Connector
Connection utilities for lua-resty-redis
Stars: ✭ 186 (-3.63%)
Mutual labels:  redis

Rate Limit

Build Scrutinizer Code Quality Code Coverage Latest Stable Version PDS Skeleton

General purpose rate limiter that can be used to limit the rate at which certain operation can be performed. Default implementation uses Redis as backend.

Installation

The preferred method of installation is via Composer. Run the following command to install the latest version of a package and add it to your project's composer.json:

composer require nikolaposa/rate-limit

Usage

Offensive rate limiting

use RateLimit\Exception\LimitExceeded;
use RateLimit\Rate;
use RateLimit\RedisRateLimiter;
use Redis;

$rateLimiter = new RedisRateLimiter(new Redis());

$apiKey = 'abc123';

try {
    $rateLimiter->limit($apiKey, Rate::perMinute(100));
    
    //on success
} catch (LimitExceeded $exception) {
   //on limit exceeded
}

Silent rate limiting

use RateLimit\Rate;
use RateLimit\RedisRateLimiter;
use Redis;

$rateLimiter = new RedisRateLimiter(new Redis());

$ipAddress = '192.168.1.2';
$status = $rateLimiter->limitSilently($ipAddress, Rate::perMinute(100));

echo $status->getRemainingAttempts(); //99

Credits

License

Released under MIT License - see the License File for details.

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].