Moodle PHP Documentation 4.3
Moodle 4.3.5 (Build: 20240610) (7dcfaa79f78)
|
Cache store feature: locking. More...
Public Member Functions | |
acquire_lock ($key, $ownerid) | |
Acquires a lock on the given key for the given identifier. | |
check_lock_state ($key, $ownerid) | |
Test if there is already a lock for the given key and if there is whether it belongs to the calling code. | |
release_lock ($key, $ownerid) | |
Releases the lock on the given key. | |
Cache store feature: locking.
This is a feature that cache stores can implement if they wish to support locking themselves rather than having the cache loader handle it for them.
Can be implemented by classes already implementing cache_store.
cache_is_lockable::acquire_lock | ( | $key, | |
$ownerid ) |
Acquires a lock on the given key for the given identifier.
string | $key | The key we are locking. |
string | $ownerid | The identifier so we can check if we have the lock or if it is someone else. The use of this property is entirely optional and implementations can act as they like upon it. |
bool | True if the lock could be acquired, false otherwise. |
Implemented in cachestore_file, and cachestore_redis.
cache_is_lockable::check_lock_state | ( | $key, | |
$ownerid ) |
Test if there is already a lock for the given key and if there is whether it belongs to the calling code.
string | $key | The key we are locking. |
string | $ownerid | The identifier so we can check if we have the lock or if it is someone else. |
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. |
Implemented in cachestore_file, and cachestore_redis.
cache_is_lockable::release_lock | ( | $key, | |
$ownerid ) |
Releases the lock on the given key.
string | $key | The key we are locking. |
string | $ownerid | The identifier so we can check if we have the lock or if it is someone else. The use of this property is entirely optional and implementations can act as they like upon it. |
bool | True if the lock has been released, false if there was a problem releasing the lock. |
Implemented in cachestore_file, and cachestore_redis.