Crate tocket

Source
Expand description

§Tocket

This library provides implementation of token bucket algorithm and some storage implementations.

§Available storages:

You can implement your own storage (e.g. Postgres).

§Features

  • redis-impl - redis storage implementation
  • distributed-impl - distributed storage implementation

Re-exports§

pub use in_memory::*;
pub use distributed::*;distributed-impl
pub use in_redis::*;redis-impl

Modules§

distributeddistributed-impl
in_memory
in_redisredis-impl

Structs§

RateLimitExceededError
State
State of token bucket.
TokenBucket
Rate limiter that implements token bucket algorithm.
TokenBucketAlgorithm
Struct that implements token bucket algorithm.

Traits§

Storage
Trait that provides function for tokens acquiring.