RateLimitedWithRedis
class RateLimitedWithRedis extends RateLimited (View source)
Traits
Properties
| protected RateLimiter | $limiter | The rate limiter instance.  | 
                from RateLimited | 
| protected string | $limiterName | The name of the rate limiter.  | 
                from RateLimited | 
| bool | $shouldRelease | Indicates if the job should be released if the limit is exceeded.  | 
                from RateLimited | 
| protected Factory | $redis | The Redis factory implementation.  | 
                |
| array | $decaysAt | The timestamp of the end of the current duration by key.  | 
                
Methods
Create a new middleware instance.
Handle a rate limited job.
Do not release the job back to the queue if the limit is exceeded.
Get the number of seconds that should elapse before the job is retried.
Prepare the object after unserialization.
Get the number of seconds until the given DateTime.
If the given value is an interval, convert it to a DateTime instance.
Determine if the given key has been "accessed" too many times.
Details
        
                            void
    __construct(string $limiterName)
        
    
    Create a new middleware instance.
        
                            mixed
    handle(mixed $job, callable $next)
        
    
    Process the job.
        
                    protected        mixed
    handleJob(mixed $job, callable $next, array $limits)
        
    
    Handle a rate limited job.
        
                            $this
    dontRelease()
        
    
    Do not release the job back to the queue if the limit is exceeded.
        
                    protected        int
    getTimeUntilNextRetry(string $key)
        
    
    Get the number of seconds that should elapse before the job is retried.
        
                            array
    __sleep()
        
    
    Prepare the object for serialization.
        
                            void
    __wakeup()
        
    
    Prepare the object after unserialization.
        
                    protected        int
    secondsUntil(DateTimeInterface|DateInterval|int $delay)
        
    
    Get the number of seconds until the given DateTime.
        
                    protected        int
    availableAt(DateTimeInterface|DateInterval|int $delay = 0)
        
    
    Get the "available at" UNIX timestamp.
        
                    protected        DateTimeInterface|int
    parseDateInterval(DateTimeInterface|DateInterval|int $delay)
        
    
    If the given value is an interval, convert it to a DateTime instance.
        
                    protected        int
    currentTime()
        
    
    Get the current system time as a UNIX timestamp.
        
                    protected        bool
    tooManyAttempts(string $key, int $maxAttempts, int $decayMinutes)
        
    
    Determine if the given key has been "accessed" too many times.