com\setasign\SetaFramework\Helper\RateLimiter

CacheRateLimiter Class CacheRateLimiter

File: /SetaFramework/src/Helper/RateLimiter/CacheRateLimiter.php

Class hierarchy

Implements

Summary

Properties

$cache

$cacheNamePrefix

$hardLock

$sleepWrapper

$softLock


Methods

__construct()

public CacheRateLimiter::__construct (
\Psr\SimpleCache\CacheInterface $cache,
string $cacheNamePrefix = 'ratelimiter_',
int $softLock = 10,
?int $hardLock = null,
int $interval = 20,
?\com\setasign\SetaFramework\Helper\FunctionWrapper\SleepWrapper $sleepWrapper = null
)

CacheRateLimiter constructor.

Parameters
$cache : \Psr\SimpleCache\CacheInterface
 
$cacheNamePrefix : string
 
$softLock : int
 
$hardLock : ?int
 
$interval : int

Wait interval in minutes to reset the counter

$sleepWrapper : ?\com\setasign\SetaFramework\Helper\FunctionWrapper\SleepWrapper
 

throttleRequest()

public CacheRateLimiter::throttleRequest (
\Psr\Http\Message\ServerRequestInterface $request
): void
Parameters
$request : \Psr\Http\Message\ServerRequestInterface
 
Exceptions

Throws HardLockException if the rate limiter reached the hard lock