TYPE_EXCLUSIVE
TYPE_EXCLUSIVE
The Horde_Lock class provides an API to create, store, check and expire locks based on a given resource URI.
Copyright 2008-2017 Horde LLC (http://www.horde.org/)
See the enclosed file LICENSE for license information (LGPL). If you did not receive this file, see http://www.horde.org/licenses/lgpl21.
getLocks(string $scope = null, string $principal = null, integer $type = null) : array
Return a list of valid locks with the option to limit the results by principal, scope and/or type.
string | $scope | The scope of the lock. Typically the name of the application requesting the lock or some other identifier used to group locks together. |
string | $principal | Principal for which to check for locks |
integer | $type | Only return locks of the given type. Defaults to null, or all locks |
Array of locks with the ID as the key and the lock details as the value. If there are no current locks this will return an empty array.
resetLock(string $lockid, integer $extend) : boolean
Extend the valid lifetime of a valid lock to now + $extend.
string | $lockid | Lock ID to reset. Must be a valid, non-expired lock. |
integer | $extend | Extend lock this many seconds from now. |
Returns true on success.
setLock(string $requestor, string $scope, string $principal, integer $lifetime = 1, $exclusive = \Horde_Lock::TYPE_SHARED) : mixed
Sets a lock on the requested principal and returns the generated lock ID. NOTE: No security checks are done in the Horde_Lock API. It is expected that the calling application has done all necessary security checks before requesting a lock be granted.
string | $requestor | User ID of the lock requestor. |
string | $scope | The scope of the lock. Typically the name of the application requesting the lock or some other identifier used to group locks together. |
string | $principal | A principal on which a lock should be granted. The format can be any string but is suggested to be in URI form. |
integer | $lifetime | Time (in seconds) for which the lock will be considered valid. |
$exclusive |
A string lock ID.
clearLock(string $lockid) : boolean
Removes a lock given the lock ID.
NOTE: No security checks are done in the Horde_Lock API. It is expected that the calling application has done all necessary security checks before requesting a lock be cleared.
string | $lockid | The lock ID as generated by a previous call to setLock() |
Returns true on success.