All Projects → abo → Rerate

abo / Rerate

Licence: mit
redis-based rate counter and rate limiter

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to Rerate

Redis Ratelimit
A fixed window rate limiter based on Redis
Stars: ✭ 15 (-16.67%)
Mutual labels:  rate-limiter, redis
Portara
Portara directive is a rate limiter / throttler for GraphQL
Stars: ✭ 158 (+777.78%)
Mutual labels:  rate-limiter, redis
Exchange Rates
💱 Querying a rate-limited currency exchange API using Redis as a cache
Stars: ✭ 37 (+105.56%)
Mutual labels:  rate-limiter, redis
Limitrr
Light NodeJS rate limiting and response delaying using Redis - including Express middleware.
Stars: ✭ 203 (+1027.78%)
Mutual labels:  rate-limiter, redis
Nginx Lua Redis Rate Measuring
A lua library to provide distributed rate measurement using nginx + redis, you can use it to do a throttling system within many nodes.
Stars: ✭ 109 (+505.56%)
Mutual labels:  rate-limiter, redis
Api Boot
“ ApiBoot”是为接口服务而生的,基于“ SpringBoot”完成扩展和自动配置,内部封装了一系列的开箱即用Starters。
Stars: ✭ 460 (+2455.56%)
Mutual labels:  rate-limiter, redis
Springbootexamples
Spring Boot 学习教程
Stars: ✭ 794 (+4311.11%)
Mutual labels:  redis
Treestats.net
Player tracking for Asheron's Call
Stars: ✭ 5 (-72.22%)
Mutual labels:  redis
Goodskill
🐂基于springcloud +dubbo构建的模拟秒杀项目,模块化设计,集成了分库分表、elasticsearch🔍、gateway、mybatis-plus、spring-session等常用开源组件
Stars: ✭ 786 (+4266.67%)
Mutual labels:  redis
Spark Redis
A connector for Spark that allows reading and writing to/from Redis cluster
Stars: ✭ 773 (+4194.44%)
Mutual labels:  redis
M Mall Admin
🐶 微信小程序-小商城后台(基于 Node.js、MongoDB、Redis 开发的系统...)
Stars: ✭ 895 (+4872.22%)
Mutual labels:  redis
Graphql Redis Subscriptions
A graphql subscriptions implementation using redis and apollo's graphql-subscriptions
Stars: ✭ 829 (+4505.56%)
Mutual labels:  redis
Gopipe Redis
Utility that generates a file for mass piping in the Redis key-value store
Stars: ✭ 5 (-72.22%)
Mutual labels:  redis
Geek Framework
基于SpringBoot+Shiro+Redis+Jwt+Thymeleaf+MyBatis 开发的后台用户、角色、权限、会员管理、RestFul、Token和前台用户登录注册以及前后台用户分离的脚手架,技术交流请加QQ群:805442966
Stars: ✭ 804 (+4366.67%)
Mutual labels:  redis
Redis Migrate Tool
A convenient and useful tool for migrating data between redis group.
Stars: ✭ 824 (+4477.78%)
Mutual labels:  redis
Java Knowledge Mind Map
【🌱🌱Java服务端知识技能图谱】用思维脑图梳理汇总Java服务端知识技能
Stars: ✭ 787 (+4272.22%)
Mutual labels:  redis
Redis Marshal
Lightweight Redis data exploration tool
Stars: ✭ 16 (-11.11%)
Mutual labels:  redis
Funpyspidersearchengine
Word2vec 千人千面 个性化搜索 + Scrapy2.3.0(爬取数据) + ElasticSearch7.9.1(存储数据并提供对外Restful API) + Django3.1.1 搜索
Stars: ✭ 782 (+4244.44%)
Mutual labels:  redis
Laravel Event Broadcast
Laravel event broadcasting with Node.js, Redis & Socket.io
Stars: ✭ 5 (-72.22%)
Mutual labels:  redis
Szt Bigdata
深圳地铁大数据客流分析系统🚇🚄🌟
Stars: ✭ 826 (+4488.89%)
Mutual labels:  redis

rerate

Build Status GoDoc Go Report Card Coverage Status

rerate is a redis-based ratecounter and ratelimiter

  • Dead simple api
  • With redis as backend, multiple rate counters/limiters can work as a cluster
  • Count/Limit requests any period, 2 day, 1 hour, 5 minute or 2 second, it's up to you
  • Recording requests as a histotram, which can be used to visualize or monitor
  • Limit requests from single ip, userid, applicationid, or any other unique identifier

Tutorial

package main

import (
    "github.com/abo/rerate"
)

...

func main() {
    // redigo buckets
    pool := newRedisPool("localhost:6379", "")
    buckets := rerate.NewRedigoBuckets(pool)

    // OR redis buckets
    // client := redis.NewClient(&redis.Options{
	//	 Addr:     "localhost:6379",
	// 	 Password: "",
	// 	 DB:       0,
	// })
    // buckets := rerate.NewRedisBuckets(client)
    
    // Counter
    counter := rerate.NewCounter(buckets, "rl:test", 10 * time.Minute, 15 * time.Second)
    counter.Inc("click")
    c, err := counter.Count("click")
    
    // Limiter
    limiter := rerate.NewLimiter(buckets, "rl:test", 1 * time.Hour, 15 * time.Minute, 100)
    limiter.Inc("114.255.86.200")
    rem, err := limiter.Remaining("114.255.86.200")
    exceed, err := limiter.Exceeded("114.255.86.200")
}

Installation

Install rerate using the "go get" command:

go get github.com/abo/rerate

Documentation

Sample - Sparkline

    cd cmd/sparkline
    npm install webpack -g
    npm install
    webpack && go run main.go

Open http://localhost:8080 in Browser, And then move mouse.

Contributing

WELCOME

License

rerate is available under the The MIT License (MIT).

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