platform/api/laravel/Redis/Limiters/DurationLimiter.yaml
2024-09-02 10:44:11 -07:00

163 lines
3.7 KiB
YAML

name: DurationLimiter
class_comment: null
dependencies:
- name: LimiterTimeoutException
type: class
source: Illuminate\Contracts\Redis\LimiterTimeoutException
- name: Sleep
type: class
source: Illuminate\Support\Sleep
properties:
- name: redis
visibility: private
comment: '# * The Redis factory implementation.
# *
# * @var \Illuminate\Redis\Connections\Connection'
- name: name
visibility: private
comment: '# * The unique name of the lock.
# *
# * @var string'
- name: maxLocks
visibility: private
comment: '# * The allowed number of concurrent tasks.
# *
# * @var int'
- name: decay
visibility: private
comment: '# * The number of seconds a slot should be maintained.
# *
# * @var int'
- name: decaysAt
visibility: public
comment: '# * The timestamp of the end of the current duration.
# *
# * @var int'
- name: remaining
visibility: public
comment: '# * The number of remaining slots.
# *
# * @var int'
methods:
- name: __construct
visibility: public
parameters:
- name: redis
- name: name
- name: maxLocks
- name: decay
comment: "# * The Redis factory implementation.\n# *\n# * @var \\Illuminate\\Redis\\\
Connections\\Connection\n# */\n# private $redis;\n# \n# /**\n# * The unique name\
\ of the lock.\n# *\n# * @var string\n# */\n# private $name;\n# \n# /**\n# * The\
\ allowed number of concurrent tasks.\n# *\n# * @var int\n# */\n# private $maxLocks;\n\
# \n# /**\n# * The number of seconds a slot should be maintained.\n# *\n# * @var\
\ int\n# */\n# private $decay;\n# \n# /**\n# * The timestamp of the end of the\
\ current duration.\n# *\n# * @var int\n# */\n# public $decaysAt;\n# \n# /**\n\
# * The number of remaining slots.\n# *\n# * @var int\n# */\n# public $remaining;\n\
# \n# /**\n# * Create a new duration limiter instance.\n# *\n# * @param \\Illuminate\\\
Redis\\Connections\\Connection $redis\n# * @param string $name\n# * @param\
\ int $maxLocks\n# * @param int $decay\n# * @return void"
- name: block
visibility: public
parameters:
- name: timeout
- name: callback
default: 'null'
- name: sleep
default: '750'
comment: '# * Attempt to acquire the lock for the given number of seconds.
# *
# * @param int $timeout
# * @param callable|null $callback
# * @param int $sleep
# * @return mixed
# *
# * @throws \Illuminate\Contracts\Redis\LimiterTimeoutException'
- name: acquire
visibility: public
parameters: []
comment: '# * Attempt to acquire the lock.
# *
# * @return bool'
- name: tooManyAttempts
visibility: public
parameters: []
comment: '# * Determine if the key has been "accessed" too many times.
# *
# * @return bool'
- name: clear
visibility: public
parameters: []
comment: '# * Clear the limiter.
# *
# * @return void'
- name: luaScript
visibility: protected
parameters: []
comment: '# * Get the Lua script for acquiring a lock.
# *
# * KEYS[1] - The limiter name
# * ARGV[1] - Current time in microseconds
# * ARGV[2] - Current time in seconds
# * ARGV[3] - Duration of the bucket
# * ARGV[4] - Allowed number of tasks
# *
# * @return string'
- name: tooManyAttemptsLuaScript
visibility: protected
parameters: []
comment: '# * Get the Lua script to determine if the key has been "accessed" too
many times.
# *
# * KEYS[1] - The limiter name
# * ARGV[1] - Current time in microseconds
# * ARGV[2] - Current time in seconds
# * ARGV[3] - Duration of the bucket
# * ARGV[4] - Allowed number of tasks
# *
# * @return string'
traits:
- Illuminate\Contracts\Redis\LimiterTimeoutException
- Illuminate\Support\Sleep
interfaces: []