Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Redis-backed rate limiter
Ruby
branch: master
Failed to load latest commit information.
lib 0.0.9
spec Add retry_in?
.gitignore dont check in Gemfile.lock
.travis.yml Update .travis.yml
Gemfile move coveralls from gemfile to gemspec
LICENSE update license
README.md Add retry_in?
Rakefile travis-ci and readme.md
redis_rate_limiter.gemspec Update email

README.md

RedisRateLimiter

Build Status Coverage Status

Redis-backed rate limiter

Usage

Initialize with preferred limit for a given interval. For example, to rate limit an action 100 times a minute:

redis = Redis.new
rl = RedisRateLimiter.new("messages", redis, :limit => 100, :interval => 60)

Add to subject's count:

sender = "John"
rl.add(sender)

Check if subject has exceeded limit:

rl.exceeded?(sender)

Query number of seconds until subject is not rate limited (returns 0.0 if subject is not rate limited):

rl.retry_in?(sender)

Documentation

http://rubydoc.info/github/seanxiesx/redis_rate_limiter/master/frames

Something went wrong with that request. Please try again.