Swiftpack.co - perrystreetsoftware/tokenbucketratelimiter as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by perrystreetsoftware.
perrystreetsoftware/tokenbucketratelimiter 0.0.15
A token bucket rate limiter implemented in Swift
⭐️ 0
🕓 2 years ago
.package(url: "https://github.com/perrystreetsoftware/tokenbucketratelimiter.git", from: "0.0.15")

TokenBucketRateLimiter

This package implements a token bucket rate limiter, as originally described at http://code.activestate.com/recipes/511490-implementation-of-the-token-bucket-algorithm/

A token bucket rate limiter is discussed at: https://en.wikipedia.org/wiki/Token_bucket

Also: https://medium.com/smyte/rate-limiter-df3408325846

The industry standard algorithm for rate limiting is called a token bucket, sometimes called a “leaky bucket”. Each bucket has a string key and initially contains the maximum number of tokens. Every time an event occurs, you check if the bucket contains enough tokens and reduce the number of tokens in the bucket by the requested amount. After a period of time called the refill time, the number of tokens in the bucket is increased by the refill amount. Over time, these refills will fill up the bucket to the maximum number of tokens.

GitHub

link
Stars: 0
Last commit: 2 years ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics