|
| | get_index_from_key ($key) |
| | This function generates the unique index for a specific lock key using a sha1 prefix converted to decimal.
|
| |
| | get_unique_db_instance_id () |
| | Calculate a unique instance id based on the database name and prefix.
|
| |
|
|
moodle_database | $db |
| | $db Hold a reference to the global $DB
|
| |
|
int | $dblockid = -1 |
| | $dblockid - used as a namespace for these types of locks (separate from session locks)
|
| |
|
int[] | $resourcetokens = [] |
| | $resourcetokens Mapping of held locks (resource identifier => internal token)
|
| |
|
string | $type |
| | $type Used to prefix lock keys
|
| |
|
|
static array | $lockidcache = array() |
| | $lockidcache - static cache for string -> int conversions required for pg advisory locks.
|
| |
|
static int[] | $locksbytoken = [] |
| | $locksbytoken Mapping of held locks (db connection => internal token => number of locks held)
|
| |
- Copyright
- Damyon Wiese 2013
- License
- http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
◆ __construct()
| core\lock\postgres_lock_factory::__construct |
( |
| $type | ) |
|
◆ auto_release()
| core\lock\postgres_lock_factory::auto_release |
( |
| ) |
|
Auto release any open locks on shutdown.
This is required, because we may be using persistent DB connections.
◆ extend_lock()
| core\lock\postgres_lock_factory::extend_lock |
( |
| ) |
|
◆ get_index_from_key()
| core\lock\postgres_lock_factory::get_index_from_key |
( |
| $key | ) |
|
|
protected |
This function generates the unique index for a specific lock key using a sha1 prefix converted to decimal.
- Parameters
-
- Return values
-
- Exceptions
-
◆ get_lock()
| core\lock\postgres_lock_factory::get_lock |
( |
| $resource, |
|
|
| $timeout, |
|
|
| $maxlifetime = 86400 ) |
Create and get a lock.
- Parameters
-
| string | $resource | - The identifier for the lock. Should use frankenstyle prefix. |
| int | $timeout | - The number of seconds to wait for a lock before giving up. |
| int | $maxlifetime | - Unused by this lock type. |
- Return values
-
| core::lock::lock|boolean | - An instance of core\lock\lock if the lock was obtained, or false. |
Implements core\lock\lock_factory.
◆ get_unique_db_instance_id()
| core\lock\postgres_lock_factory::get_unique_db_instance_id |
( |
| ) |
|
|
protected |
Calculate a unique instance id based on the database name and prefix.
- Return values
-
◆ is_available()
| core\lock\postgres_lock_factory::is_available |
( |
| ) |
|
Is available.
- Return values
-
| boolean | - True if this lock type is available in this environment. |
Implements core\lock\lock_factory.
◆ release_lock()
| core\lock\postgres_lock_factory::release_lock |
( |
lock | $lock | ) |
|
Release a lock that was previously obtained with @lock.
- Parameters
-
| lock | $lock | - a lock obtained from this factory. |
- Return values
-
| boolean | - true if the lock is no longer held (including if it was never held). |
Implements core\lock\lock_factory.
◆ supports_auto_release()
| core\lock\postgres_lock_factory::supports_auto_release |
( |
| ) |
|
Will this lock type will be automatically released when a process ends.
- Return values
-
| boolean | - Via shutdown handler. |
Implements core\lock\lock_factory.
◆ supports_recursion()
| core\lock\postgres_lock_factory::supports_recursion |
( |
| ) |
|
◆ supports_timeout()
| core\lock\postgres_lock_factory::supports_timeout |
( |
| ) |
|
Return information about the blocking behaviour of the lock type on this platform.
- Return values
-
| boolean | - Defer to the DB driver. |
Implements core\lock\lock_factory.
The documentation for this class was generated from the following file:
- lib/classes/lock/postgres_lock_factory.php