api/laravel/Cache/RateLimiter.yaml

244 lines
4.7 KiB
YAML
Raw Normal View History

2024-09-26 09:03:21 +00:00
name: RateLimiter
class_comment: null
dependencies:
- name: Closure
type: class
source: Closure
- name: Cache
type: class
source: Illuminate\Contracts\Cache\Repository
- name: InteractsWithTime
type: class
source: Illuminate\Support\InteractsWithTime
- name: InteractsWithTime
type: class
source: InteractsWithTime
properties:
- name: cache
visibility: protected
comment: '# * The cache store implementation.
# *
# * @var \Illuminate\Contracts\Cache\Repository'
- name: limiters
visibility: protected
comment: '# * The configured limit object resolvers.
# *
# * @var array'
methods:
- name: __construct
visibility: public
parameters:
- name: cache
comment: "# * The cache store implementation.\n# *\n# * @var \\Illuminate\\Contracts\\\
Cache\\Repository\n# */\n# protected $cache;\n# \n# /**\n# * The configured limit\
\ object resolvers.\n# *\n# * @var array\n# */\n# protected $limiters = [];\n\
# \n# /**\n# * Create a new rate limiter instance.\n# *\n# * @param \\Illuminate\\\
Contracts\\Cache\\Repository $cache\n# * @return void"
- name: for
visibility: public
parameters:
- name: name
- name: callback
comment: '# * Register a named limiter configuration.
# *
# * @param string $name
# * @param \Closure $callback
# * @return $this'
- name: limiter
visibility: public
parameters:
- name: name
comment: '# * Get the given named rate limiter.
# *
# * @param string $name
# * @return \Closure|null'
- name: attempt
visibility: public
parameters:
- name: key
- name: maxAttempts
- name: callback
- name: decaySeconds
default: '60'
comment: '# * Attempts to execute a callback if it''s not limited.
# *
# * @param string $key
# * @param int $maxAttempts
# * @param \Closure $callback
# * @param int $decaySeconds
# * @return mixed'
- name: tooManyAttempts
visibility: public
parameters:
- name: key
- name: maxAttempts
comment: '# * Determine if the given key has been "accessed" too many times.
# *
# * @param string $key
# * @param int $maxAttempts
# * @return bool'
- name: hit
visibility: public
parameters:
- name: key
- name: decaySeconds
default: '60'
comment: '# * Increment (by 1) the counter for a given key for a given decay time.
# *
# * @param string $key
# * @param int $decaySeconds
# * @return int'
- name: increment
visibility: public
parameters:
- name: key
- name: decaySeconds
default: '60'
- name: amount
default: '1'
comment: '# * Increment the counter for a given key for a given decay time by a
given amount.
# *
# * @param string $key
# * @param int $decaySeconds
# * @param int $amount
# * @return int'
- name: decrement
visibility: public
parameters:
- name: key
- name: decaySeconds
default: '60'
- name: amount
default: '1'
comment: '# * Decrement the counter for a given key for a given decay time by a
given amount.
# *
# * @param string $key
# * @param int $decaySeconds
# * @param int $amount
# * @return int'
- name: attempts
visibility: public
parameters:
- name: key
comment: '# * Get the number of attempts for the given key.
# *
# * @param string $key
# * @return mixed'
- name: resetAttempts
visibility: public
parameters:
- name: key
comment: '# * Reset the number of attempts for the given key.
# *
# * @param string $key
# * @return mixed'
- name: remaining
visibility: public
parameters:
- name: key
- name: maxAttempts
comment: '# * Get the number of retries left for the given key.
# *
# * @param string $key
# * @param int $maxAttempts
# * @return int'
- name: retriesLeft
visibility: public
parameters:
- name: key
- name: maxAttempts
comment: '# * Get the number of retries left for the given key.
# *
# * @param string $key
# * @param int $maxAttempts
# * @return int'
- name: clear
visibility: public
parameters:
- name: key
comment: '# * Clear the hits and lockout timer for the given key.
# *
# * @param string $key
# * @return void'
- name: availableIn
visibility: public
parameters:
- name: key
comment: '# * Get the number of seconds until the "key" is accessible again.
# *
# * @param string $key
# * @return int'
- name: cleanRateLimiterKey
visibility: public
parameters:
- name: key
comment: '# * Clean the rate limiter key from unicode characters.
# *
# * @param string $key
# * @return string'
traits:
- Closure
- Illuminate\Support\InteractsWithTime
- InteractsWithTime
interfaces: []