158 lines
5.7 KiB
YAML
158 lines
5.7 KiB
YAML
|
name: DoctrineDbalStore
|
||
|
class_comment: "# * DbalStore is a PersistingStoreInterface implementation using a\
|
||
|
\ Doctrine DBAL 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: Configuration
|
||
|
type: class
|
||
|
source: Doctrine\DBAL\Configuration
|
||
|
- name: Connection
|
||
|
type: class
|
||
|
source: Doctrine\DBAL\Connection
|
||
|
- name: DriverManager
|
||
|
type: class
|
||
|
source: Doctrine\DBAL\DriverManager
|
||
|
- name: DBALException
|
||
|
type: class
|
||
|
source: Doctrine\DBAL\Exception
|
||
|
- name: TableNotFoundException
|
||
|
type: class
|
||
|
source: Doctrine\DBAL\Exception\TableNotFoundException
|
||
|
- name: ParameterType
|
||
|
type: class
|
||
|
source: Doctrine\DBAL\ParameterType
|
||
|
- name: DefaultSchemaManagerFactory
|
||
|
type: class
|
||
|
source: Doctrine\DBAL\Schema\DefaultSchemaManagerFactory
|
||
|
- name: Schema
|
||
|
type: class
|
||
|
source: Doctrine\DBAL\Schema\Schema
|
||
|
- name: DsnParser
|
||
|
type: class
|
||
|
source: Doctrine\DBAL\Tools\DsnParser
|
||
|
- 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: connOrUrl
|
||
|
- name: options
|
||
|
default: '[]'
|
||
|
- name: gcProbability
|
||
|
default: '0.01'
|
||
|
- name: initialTtl
|
||
|
default: '300'
|
||
|
comment: "# * DbalStore is a PersistingStoreInterface implementation using a Doctrine\
|
||
|
\ DBAL 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 DoctrineDbalStore implements PersistingStoreInterface\n# {\n# use\
|
||
|
\ DatabaseTableTrait;\n# use ExpiringStoreTrait;\n# \n# private Connection $conn;\n\
|
||
|
# \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# *\n# * @param Connection|string $connOrUrl\
|
||
|
\ A DBAL Connection instance or Doctrine URL\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 namespace\
|
||
|
\ contains invalid characters\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: createTable
|
||
|
visibility: public
|
||
|
parameters: []
|
||
|
comment: '# * Creates the table to store lock keys which can be called once for
|
||
|
setup.
|
||
|
|
||
|
# *
|
||
|
|
||
|
# * @throws DBALException When the table already exists'
|
||
|
- name: configureSchema
|
||
|
visibility: public
|
||
|
parameters:
|
||
|
- name: schema
|
||
|
- name: isSameDatabase
|
||
|
comment: '# * Adds the Table to the Schema if it doesn''t exist.'
|
||
|
- name: prune
|
||
|
visibility: private
|
||
|
parameters: []
|
||
|
comment: '# * Cleans up the table by removing all expired locks.'
|
||
|
- name: getCurrentTimestampStatement
|
||
|
visibility: private
|
||
|
parameters: []
|
||
|
comment: '# * Provides an SQL function to get the current timestamp regarding the
|
||
|
current connection''s driver.'
|
||
|
- name: platformSupportsTableCreationInTransaction
|
||
|
visibility: private
|
||
|
parameters: []
|
||
|
comment: '# * Checks whether current platform supports table creation within transaction.'
|
||
|
traits:
|
||
|
- Doctrine\DBAL\Configuration
|
||
|
- Doctrine\DBAL\Connection
|
||
|
- Doctrine\DBAL\DriverManager
|
||
|
- Doctrine\DBAL\Exception\TableNotFoundException
|
||
|
- Doctrine\DBAL\ParameterType
|
||
|
- Doctrine\DBAL\Schema\DefaultSchemaManagerFactory
|
||
|
- Doctrine\DBAL\Schema\Schema
|
||
|
- Doctrine\DBAL\Tools\DsnParser
|
||
|
- 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
|