Moodle APIs
3.8
Moodle 3.8.6 (Build: 20201109)
|
Cache store feature: locking. More...
Public Member Functions | |
acquire_lock ($key, $ownerid) | |
Acquires a lock on the given key for the given identifier. More... | |
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. More... | |
release_lock ($key, $ownerid) | |
Releases the lock on the given key. More... | |
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_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_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_redis.