46 lines
2 KiB
YAML
46 lines
2 KiB
YAML
name: DatabaseTableTrait
|
|
class_comment: null
|
|
dependencies:
|
|
- name: InvalidArgumentException
|
|
type: class
|
|
source: Symfony\Component\Lock\Exception\InvalidArgumentException
|
|
- name: InvalidTtlException
|
|
type: class
|
|
source: Symfony\Component\Lock\Exception\InvalidTtlException
|
|
- name: Key
|
|
type: class
|
|
source: Symfony\Component\Lock\Key
|
|
properties: []
|
|
methods:
|
|
- name: getHashedKey
|
|
visibility: private
|
|
parameters:
|
|
- name: key
|
|
comment: "# * @internal\n# */\n# trait DatabaseTableTrait\n# {\n# private string\
|
|
\ $table = 'lock_keys';\n# private string $idCol = 'key_id';\n# private string\
|
|
\ $tokenCol = 'key_token';\n# private string $expirationCol = 'key_expiration';\n\
|
|
# private float $gcProbability;\n# private int $initialTtl;\n# \n# private function\
|
|
\ init(array $options, float $gcProbability, int $initialTtl): void\n# {\n# if\
|
|
\ ($gcProbability < 0 || $gcProbability > 1) {\n# throw new InvalidArgumentException(\\\
|
|
sprintf('\"%s\" requires gcProbability between 0 and 1, \"%f\" given.', __METHOD__,\
|
|
\ $gcProbability));\n# }\n# if ($initialTtl < 1) {\n# throw new InvalidTtlException(\\\
|
|
sprintf('\"%s()\" expects a strictly positive TTL, \"%d\" given.', __METHOD__,\
|
|
\ $initialTtl));\n# }\n# \n# $this->table = $options['db_table'] ?? $this->table;\n\
|
|
# $this->idCol = $options['db_id_col'] ?? $this->idCol;\n# $this->tokenCol = $options['db_token_col']\
|
|
\ ?? $this->tokenCol;\n# $this->expirationCol = $options['db_expiration_col']\
|
|
\ ?? $this->expirationCol;\n# \n# $this->gcProbability = $gcProbability;\n# $this->initialTtl\
|
|
\ = $initialTtl;\n# }\n# \n# /**\n# * Returns a hashed version of the key."
|
|
- name: getUniqueToken
|
|
visibility: private
|
|
parameters:
|
|
- name: key
|
|
comment: null
|
|
- name: randomlyPrune
|
|
visibility: private
|
|
parameters: []
|
|
comment: '# * Prune the table randomly, based on GC probability.'
|
|
traits:
|
|
- Symfony\Component\Lock\Exception\InvalidArgumentException
|
|
- Symfony\Component\Lock\Exception\InvalidTtlException
|
|
- Symfony\Component\Lock\Key
|
|
interfaces: []
|