All Projects → go-redis → Redis_rate

go-redis / Redis_rate

Licence: bsd-2-clause
Rate limiting for go-redis

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to Redis rate

Redisratelimiter
Redis Based API Access Rate Limiter
Stars: ✭ 80 (-67.74%)
Mutual labels:  redis, rate-limiting
Redis Ratelimit
A fixed window rate limiter based on Redis
Stars: ✭ 15 (-93.95%)
Mutual labels:  redis, rate-limiting
Speedbump
A Redis-backed rate limiter in Go
Stars: ✭ 107 (-56.85%)
Mutual labels:  redis, rate-limiting
Express Security
nodejs + express security and performance boilerplate.
Stars: ✭ 37 (-85.08%)
Mutual labels:  redis, rate-limiting
Rate Limit
🚔 General purpose rate limiter implementation.
Stars: ✭ 193 (-22.18%)
Mutual labels:  redis, rate-limiting
Redis Windows
Vagrant redis configuration and the binary releases of MS Open Tech redis port of windows
Stars: ✭ 2,596 (+946.77%)
Mutual labels:  redis
Rusty Celery
🦀 Rust implementation of Celery for producing and consuming background tasks
Stars: ✭ 243 (-2.02%)
Mutual labels:  redis
Redis Cluster
Redis Cluster setup running on Kubernetes
Stars: ✭ 230 (-7.26%)
Mutual labels:  redis
Syncclient
syncClient,数据实时同步中间件(同步mysql到kafka、redis、elasticsearch、httpmq)!
Stars: ✭ 227 (-8.47%)
Mutual labels:  redis
Spring Cloud Shop
spring cloud 版分布式电商项目,全力打造顶级多模块,高可用,高扩展电商项目
Stars: ✭ 248 (+0%)
Mutual labels:  redis
Awesome crawl
腾讯新闻、知乎话题、微博粉丝,Tumblr爬虫、斗鱼弹幕、妹子图爬虫、分布式设计等
Stars: ✭ 246 (-0.81%)
Mutual labels:  redis
Kue Scheduler
A job scheduler utility for kue, backed by redis and built for node.js
Stars: ✭ 240 (-3.23%)
Mutual labels:  redis
Php
PHP相关资料
Stars: ✭ 234 (-5.65%)
Mutual labels:  redis
Docker Lnmp
🐋Docker-compose(Linux,Nginx,MySQL,PHP7,Redis)
Stars: ✭ 244 (-1.61%)
Mutual labels:  redis
Chameleon
Customizable honeypots for monitoring network traffic, bots activities and username\password credentials (DNS, HTTP Proxy, HTTP, HTTPS, SSH, POP3, IMAP, STMP, RDP, VNC, SMB, SOCKS5, Redis, TELNET, Postgres and MySQL)
Stars: ✭ 230 (-7.26%)
Mutual labels:  redis
Spring Boot Start Current
Spring Boot 脚手架 Mybatis Spring Security JWT 权限 Spring Cache + Redis
Stars: ✭ 246 (-0.81%)
Mutual labels:  redis
Redis Smq
A simple high-performance Redis message queue for Node.js.
Stars: ✭ 230 (-7.26%)
Mutual labels:  redis
Golang Url Shortener
URL Shortener written in Golang using Bolt DB or Redis. Provides features such as Deletion, Expiration, OAuth and is of course Dockerizable.
Stars: ✭ 240 (-3.23%)
Mutual labels:  redis
Zapi
基于swoole的异步轻量级api框架,内部封装全套mysql、redis、mongo、memcached异步客户端,可以轻松start、reload、stop,加入数据库的查询模块,框架已经封装好近乎同步写法,底层异步调用。现已支持异步mysql、异步redis、异步http请求.
Stars: ✭ 245 (-1.21%)
Mutual labels:  redis
Video Chat
Video chat app using Vue, Vuex, WebRTC, SocketIO, Node, Redis & Docker with horizontal scaling. Multiparty and 1 to 1 video functionality, several public rooms and user status
Stars: ✭ 240 (-3.23%)
Mutual labels:  redis

Rate limiting for go-redis

Build Status PkgGoDev

❤️ Uptrace.dev - distributed traces, logs, and errors in one place

This package is based on rwz/redis-gcra and implements GCRA (aka leaky bucket) for rate limiting based on Redis. The code requires Redis version 3.2 or newer since it relies on replicate_commands feature.

Installation

redis_rate supports 2 last Go versions and requires a Go version with modules support. So make sure to initialize a Go module:

go mod init github.com/my/repo

And then install redis_rate/v9 (note v9 in the import; omitting it is a popular mistake):

go get github.com/go-redis/redis_rate/v9

Example

package redis_rate_test

import (
	"context"
	"fmt"

	"github.com/go-redis/redis/v8"
	"github.com/go-redis/redis_rate/v9"
)

func ExampleNewLimiter() {
	ctx := context.Background()
	rdb := redis.NewClient(&redis.Options{
		Addr: "localhost:6379",
	})
	_ = rdb.FlushDB(ctx).Err()

	limiter := redis_rate.NewLimiter(rdb)
	res, err := limiter.Allow(ctx, "project:123", redis_rate.PerSecond(10))
	if err != nil {
		panic(err)
	}
	fmt.Println("allowed", res.Allowed, "remaining", res.Remaining)
	// Output: allowed 1 remaining 9
}
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].