Throttler.php
system/Throttle/Throttler.php
1 class
6 methods
class Throttler
Class Throttler Uses an implementation of the Token Bucket algorithm to implement a "rolling window" type of throttling that can be used for rate limiting an API or any other request. Each "token" in the "bucket" is equivalent to a single request for the purposes of this implementation.
__construct
(CacheInterface $cache)
getTokenTime
()
check
(string $key, int $capacity, int $seconds, int $cost = 1)
remove
(string $key)
setTestTime
(int $time)
time
()