|
| __construct ($name, array $configuration=[]) |
| Constructs an instance of the cache lock given its name and its configuration data.
|
|
| __destruct () |
| Cleans up any left over locks.
|
|
| check_state ($key, $ownerid) |
| Checks the state of the given key.
|
|
| lock ($key, $ownerid, $block=false) |
| Acquires a lock on a given key.
|
|
| unlock ($key, $ownerid, $forceunlock=false) |
| Releases the lock held on a certain key.
|
|
◆ __construct()
core_cache\cache_lock_interface::__construct |
( |
| $name, |
|
|
array | $configuration = [] ) |
Constructs an instance of the cache lock given its name and its configuration data.
- Parameters
-
string | $name | The unique name of the lock instance |
array | $configuration | |
◆ __destruct()
core_cache\cache_lock_interface::__destruct |
( |
| ) |
|
Cleans up any left over locks.
This function MUST clean up any locks that have been acquired and not released during processing. Although the situation of acquiring a lock and not releasing it should be insanely rare we need to deal with it. Things such as unfortunate timeouts etc could cause this situation.
◆ check_state()
core_cache\cache_lock_interface::check_state |
( |
| $key, |
|
|
| $ownerid ) |
Checks the state of the given key.
Returns true if the key is locked and belongs to the ownerid. Returns false if the key is locked but does not belong to the ownerid. Returns null if there is no lock
- Parameters
-
string | $key | The key we are checking for. |
string | $ownerid | The identifier so we can check if we have the lock or if it is someone else. |
- Return values
-
bool | True if this code has the lock, false if there is a lock but this code doesn't have it, null if there is no lock. |
◆ lock()
core_cache\cache_lock_interface::lock |
( |
| $key, |
|
|
| $ownerid, |
|
|
| $block = false ) |
Acquires a lock on a given key.
- Parameters
-
string | $key | The key to acquire a lock for. |
string | $ownerid | An unique identifier for the owner of this lock. It is entirely optional for the cache lock plugin to use this. Each implementation can decide for themselves. |
bool | $block | If set to true the application will wait until a lock can be acquired |
- Return values
-
bool | True if the lock can be acquired false otherwise. |
◆ unlock()
core_cache\cache_lock_interface::unlock |
( |
| $key, |
|
|
| $ownerid, |
|
|
| $forceunlock = false ) |
Releases the lock held on a certain key.
- Parameters
-
string | $key | The key to release the lock for. |
string | $ownerid | An unique identifier for the owner of this lock. It is entirely optional for the cache lock plugin to use this. Each implementation can decide for themselves. |
bool | $forceunlock | If set to true the lock will be removed if it exists regardless of whether or not we own it. |
The documentation for this interface was generated from the following file:
- cache/classes/cache_lock_interface.php