com\setasign\SetaFramework\Helper\RateLimiter
CacheRateLimiter Class CacheRateLimiter
File: /SetaFramework/src/Helper/RateLimiter/CacheRateLimiter.php
Class hierarchy
Implements
Summary
Properties
$cache
private CacheRateLimiter::$cache
$cacheNamePrefix
private CacheRateLimiter::$cacheNamePrefix
$hardLock
private CacheRateLimiter::$hardLock
$interval
private \DateInterval CacheRateLimiter::$interval
$sleepWrapper
private CacheRateLimiter::$sleepWrapper
$softLock
private CacheRateLimiter::$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
)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
): voidParameters
- $request : \Psr\Http\Message\ServerRequestInterface
Exceptions
Throws HardLockException if the rate limiter reached the hard lock
