|
| __construct ($type, lock_factory $factory=null) |
| Constructor required by interface.
|
|
| extend_lock (lock $lock, $maxlifetime=86400) |
| Calls parent factory to try to extend the lock.
|
|
| get_lock ($resource, $timeout, $maxlifetime=86400) |
| Implementation of lock_factory\get_lock that defers to function inner_get_lock and keeps track of how long it took.
|
|
| get_real_factory () |
| Gets the real lock factory that this is wrapping.
|
|
| is_available () |
| Calls parent factory to check if it is available.
|
|
| release_lock (lock $lock) |
| Release a lock that was previously obtained with {.
|
|
| supports_auto_release () |
| Calls parent factory to check if it auto-releases locks.
|
|
| supports_recursion () |
| Calls parent factory to check if it supports recursion.
|
|
| supports_timeout () |
| Calls parent factory to check if it supports timeout.
|
|
|
static | record_lock_data (float $after, float $before, string $type, string $resource, bool $result, $lock) |
| Records statistics about a lock to the performance data.
|
|
static | record_lock_released_data ($lock) |
| Find the lock in the performance info and update it with the time held.
|
|
|
lock_factory | $factory |
| Real lock factory.
|
|
string | $type |
| Type (Frankenstyle) used for these locks.
|
|
- Copyright
- 2022 The Open University
- License
- http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
◆ __construct()
core\lock\timing_wrapper_lock_factory::__construct |
( |
| $type, |
|
|
lock_factory | $factory = null ) |
Constructor required by interface.
- Parameters
-
string | $type | Type (should be same as passed to real lock factory) |
lock_factory | $factory | Real lock factory |
◆ extend_lock()
core\lock\timing_wrapper_lock_factory::extend_lock |
( |
lock | $lock, |
|
|
| $maxlifetime = 86400 ) |
Calls parent factory to try to extend the lock.
- Deprecated
- since Moodle 3.10.
- Parameters
-
lock | $lock | Lock obtained from this factory |
int | $maxlifetime | New max time to hold the lock |
- Return values
-
boolean | True if the lock was extended. |
Implements core\lock\lock_factory.
◆ get_lock()
core\lock\timing_wrapper_lock_factory::get_lock |
( |
| $resource, |
|
|
| $timeout, |
|
|
| $maxlifetime = 86400 ) |
Implementation of lock_factory\get_lock that defers to function inner_get_lock and keeps track of how long it took.
- Parameters
-
string | $resource | Identifier for the lock |
int | $timeout | Number of seconds to wait for a lock before giving up |
int | $maxlifetime | Number of seconds to wait before reclaiming a stale lock |
- 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_real_factory()
core\lock\timing_wrapper_lock_factory::get_real_factory |
( |
| ) |
|
Gets the real lock factory that this is wrapping.
- Return values
-
lock_factory | ReaL lock factory |
◆ is_available()
core\lock\timing_wrapper_lock_factory::is_available |
( |
| ) |
|
Calls parent factory to check if it is available.
- Return values
-
boolean | True if this lock type is available in this environment. |
Implements core\lock\lock_factory.
◆ record_lock_data()
static core\lock\timing_wrapper_lock_factory::record_lock_data |
( |
float | $after, |
|
|
float | $before, |
|
|
string | $type, |
|
|
string | $resource, |
|
|
bool | $result, |
|
|
| $lock ) |
|
static |
Records statistics about a lock to the performance data.
- Parameters
-
float | $after | The time after the lock was achieved. |
float | $before | The time before the lock was requested. |
string | $type | The type of lock. |
string | $resource | The resource being locked. |
bool | $result | Whether the lock was successful. |
lock | string | $lock | A value uniquely identifying the lock. |
- Return values
-
◆ record_lock_released_data()
static core\lock\timing_wrapper_lock_factory::record_lock_released_data |
( |
| $lock | ) |
|
|
static |
Find the lock in the performance info and update it with the time held.
- Parameters
-
lock | string | $lock | A value uniquely identifying the lock. |
- Return values
-
◆ release_lock()
core\lock\timing_wrapper_lock_factory::release_lock |
( |
lock | $lock | ) |
|
Release a lock that was previously obtained with {.
- See also
- get_lock}.
- Parameters
-
lock | $lock | - The lock to release. |
- 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\timing_wrapper_lock_factory::supports_auto_release |
( |
| ) |
|
Calls parent factory to check if it auto-releases locks.
- Return values
-
boolean | True if this lock type will be automatically released when the current process ends. |
Implements core\lock\lock_factory.
◆ supports_recursion()
core\lock\timing_wrapper_lock_factory::supports_recursion |
( |
| ) |
|
Calls parent factory to check if it supports recursion.
- Deprecated
- since Moodle 3.10.
- Return values
-
boolean | True if attempting to get 2 locks on the same resource will "stack" |
Implements core\lock\lock_factory.
◆ supports_timeout()
core\lock\timing_wrapper_lock_factory::supports_timeout |
( |
| ) |
|
Calls parent factory to check if it supports timeout.
- Return values
-
boolean | False if attempting to get a lock will block indefinitely. |
Implements core\lock\lock_factory.
The documentation for this class was generated from the following file:
- lib/classes/lock/timing_wrapper_lock_factory.php