AthenaRatelimitBucket
class AthenaRatelimitBucket implements RatelimitBucketInterface (View source)
Manages a route's ratelimit in Redis, using Athena. Requires client option http.ratelimitbucket.athena
to be set to an instance of AthenaCache
.
Requires the suggested package charlottedunois/athena
.
Properties
protected APIManager | $api | The API manager. | |
protected string | $endpoint | The endpoint. | |
protected APIRequest[] | $queue | The request queue. | |
protected AthenaCache | $cache | The athena cache instance. | |
protected bool | $busy | Whether the bucket is busy. |
Methods
Destroys the bucket.
Whether we are busy.
Sets the busy flag (marking as running).
Sets the ratelimits from the response
Returns the endpoint this bucket is for.
Returns the size of the queue
Retrieves ratelimit meta data.
Returns the first queue item or false. Modifies remaining ratelimit.
Unsets all queue items.
Retrieves the cache data.
Sets the cache data.
Details
at line 55
__construct(APIManager $api, string $endpoint)
DO NOT initialize this class yourself.
at line 68
__destruct()
Destroys the bucket.
at line 76
bool
isBusy()
Whether we are busy.
at line 85
void
setBusy(bool $busy)
Sets the busy flag (marking as running).
at line 96
ExtendedPromiseInterface|void
handleRatelimit(int|null $limit, int|null $remaining, float|null $resetTime)
Sets the ratelimits from the response
at line 120
string
getEndpoint()
Returns the endpoint this bucket is for.
at line 128
int
size()
Returns the size of the queue
at line 137
$this
push(APIRequest $request)
Pushes a new request into the queue.
at line 147
$this
unshift(APIRequest $request)
Unshifts a new request into the queue. Modifies remaining ratelimit.
at line 172
ExtendedPromiseInterface|array
getMeta()
Retrieves ratelimit meta data.
The resolved value must be:
array(
'limited' => bool,
'resetTime' => int|null
)
at line 189
APIRequest|false
shift()
Returns the first queue item or false. Modifies remaining ratelimit.
at line 209
void
clear()
Unsets all queue items.
at line 222
protected ExtendedPromiseInterface
get()
Retrieves the cache data.
at line 233
protected ExtendedPromiseInterface
set(array $value)
Sets the cache data.