api/symfony/Component/Lock/Store/PdoStore.yaml
2024-09-26 02:03:21 -07:00

133 lines
5.3 KiB
YAML

name: PdoStore
class_comment: "# * PdoStore is a PersistingStoreInterface implementation using a\
\ PDO connection.\n# *\n# * Lock metadata are stored in a table. You can use createTable()\
\ to initialize\n# * a correctly defined table.\n# *\n# * CAUTION: This store relies\
\ on all client and server nodes to have\n# * synchronized clocks for lock expiry\
\ to occur at the correct time.\n# * To ensure locks don't expire prematurely; the\
\ TTLs should be set with enough\n# * extra time to account for any clock drift\
\ between nodes.\n# *\n# * @author J\xE9r\xE9my Deruss\xE9 <jeremy@derusse.com>"
dependencies:
- name: InvalidArgumentException
type: class
source: Symfony\Component\Lock\Exception\InvalidArgumentException
- name: InvalidTtlException
type: class
source: Symfony\Component\Lock\Exception\InvalidTtlException
- name: LockConflictedException
type: class
source: Symfony\Component\Lock\Exception\LockConflictedException
- name: Key
type: class
source: Symfony\Component\Lock\Key
- name: PersistingStoreInterface
type: class
source: Symfony\Component\Lock\PersistingStoreInterface
- name: DatabaseTableTrait
type: class
source: DatabaseTableTrait
- name: ExpiringStoreTrait
type: class
source: ExpiringStoreTrait
properties: []
methods:
- name: __construct
visibility: public
parameters:
- name: connOrDsn
- name: options
default: '[]'
- name: gcProbability
default: '0.01'
- name: initialTtl
default: '300'
comment: "# * PdoStore is a PersistingStoreInterface implementation using a PDO\
\ connection.\n# *\n# * Lock metadata are stored in a table. You can use createTable()\
\ to initialize\n# * a correctly defined table.\n# *\n# * CAUTION: This store\
\ relies on all client and server nodes to have\n# * synchronized clocks for lock\
\ expiry to occur at the correct time.\n# * To ensure locks don't expire prematurely;\
\ the TTLs should be set with enough\n# * extra time to account for any clock\
\ drift between nodes.\n# *\n# * @author J\xE9r\xE9my Deruss\xE9 <jeremy@derusse.com>\n\
# */\n# class PdoStore implements PersistingStoreInterface\n# {\n# use DatabaseTableTrait;\n\
# use ExpiringStoreTrait;\n# \n# private \\PDO $conn;\n# private string $dsn;\n\
# private string $driver;\n# private ?string $username = null;\n# private ?string\
\ $password = null;\n# private array $connectionOptions = [];\n# \n# /**\n# *\
\ You can either pass an existing database connection as PDO instance\n# * or\
\ a DSN string that will be used to lazy-connect to the database\n# * when the\
\ lock is actually used.\n# *\n# * List of available options:\n# * * db_table:\
\ The name of the table [default: lock_keys]\n# * * db_id_col: The column where\
\ to store the lock key [default: key_id]\n# * * db_token_col: The column where\
\ to store the lock token [default: key_token]\n# * * db_expiration_col: The\
\ column where to store the expiration [default: key_expiration]\n# * * db_username:\
\ The username when lazy-connect [default: '']\n# * * db_password: The password\
\ when lazy-connect [default: '']\n# * * db_connection_options: An array of driver-specific\
\ connection options [default: []]\n# *\n# * @param array $options An associative\
\ array of options\n# * @param float $gcProbability Probability expressed as floating\
\ number between 0 and 1 to clean old locks\n# * @param int $initialTtl The\
\ expiration delay of locks in seconds\n# *\n# * @throws InvalidArgumentException\
\ When first argument is not PDO nor Connection nor string\n# * @throws InvalidArgumentException\
\ When PDO error mode is not PDO::ERRMODE_EXCEPTION\n# * @throws InvalidArgumentException\
\ When the initial ttl is not valid"
- name: save
visibility: public
parameters:
- name: key
comment: null
- name: putOffExpiration
visibility: public
parameters:
- name: key
- name: ttl
comment: null
- name: delete
visibility: public
parameters:
- name: key
comment: null
- name: exists
visibility: public
parameters:
- name: key
comment: null
- name: getConnection
visibility: private
parameters: []
comment: null
- name: createTable
visibility: public
parameters: []
comment: '# * Creates the table to store lock keys which can be called once for
setup.
# *
# * @throws \PDOException When the table already exists
# * @throws \DomainException When an unsupported PDO driver is used'
- name: prune
visibility: private
parameters: []
comment: '# * Cleans up the table by removing all expired locks.'
- name: getDriver
visibility: private
parameters: []
comment: null
- name: getCurrentTimestampStatement
visibility: private
parameters: []
comment: '# * Provides an SQL function to get the current timestamp regarding the
current connection''s driver.'
- name: isTableMissing
visibility: private
parameters:
- name: exception
comment: null
traits:
- Symfony\Component\Lock\Exception\InvalidArgumentException
- Symfony\Component\Lock\Exception\InvalidTtlException
- Symfony\Component\Lock\Exception\LockConflictedException
- Symfony\Component\Lock\Key
- Symfony\Component\Lock\PersistingStoreInterface
- DatabaseTableTrait
- ExpiringStoreTrait
interfaces:
- PersistingStoreInterface