rate_limiter

A rate limiter implementation
HEAD Latest release Yanked release released
z64/rate_limiter
5 1
Zac Nowicki

This repo seems to be no longer available at z64/rate_limiter.

Git synchronization failed . Last successful sync was .

Help find it again! … or have it archived.

rate_limiter

A utility class for rate limiting, ported from @meew0's implementation in discordrb

Installation

Add this to your application's shard.yml:

dependencies:
  rate_limiter:
    github: z64/rate_limiter

Usage

require "rate_limiter"

# Make a new rate limiter that will limit based on string "usernames"
limiter = RateLimiter(String).new

# Create a bucket that allows 3 requests per second
limiter.bucket(:foo, 3_u32, 1.seconds)

# Perform a request on "z64"
limiter.rate_limited?(:foo, "z64")

Contributors

  • z64 Zac Nowicki - creator, maintainer
rate_limiter:
  github: z64/rate_limiter
  
License MIT
Crystal 0.34.0

Authors

Dependencies 0

Development Dependencies 0

Last synced .
search fire star recently