Class Horde_Lock_Null
A null driver for Horde_Lock.
Copyright 2010-2012 Horde LLC (http://www.horde.org/)
See the enclosed file COPYING for license information (LGPL). If you did
not receive this file, see http://www.horde.org/licenses/lgpl21.
-
Horde_Lock
-
Horde_Lock_Null
Methods summary
public
array
|
#
getLockInfo( string $lockid )
Return an array of information about the requested lock.
Return an array of information about the requested lock.
Parameters
- $lockid
- Lock ID to look up.
Returns
array Lock information.
Throws
|
public
array
|
#
getLocks( string $scope = null, string $principal = null, integer $type = null )
Return a list of valid locks with the option to limit the results
by principal, scope and/or type.
Return a list of valid locks with the option to limit the results
by principal, scope and/or type.
Parameters
- $scope
- <p>The scope of the lock. Typically the name of
the application requesting the lock or some
other identifier used to group locks together.</p>
- $principal
- Principal for which to check for locks
- $type
- <p>Only return locks of the given type.
Defaults to null, or all locks</p>
Returns
array 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.
Throws
|
public
boolean
|
#
resetLock( string $lockid, integer $extend )
Extend the valid lifetime of a valid lock to now + $extend.
Extend the valid lifetime of a valid lock to now + $extend.
Parameters
- $lockid
- <p>Lock ID to reset. Must be a valid, non-expired
lock.</p>
- $extend
- Extend lock this many seconds from now.
Returns
boolean Returns true on success.
Throws
|
public
mixed
|
#
setLock( string $requestor, string $scope, string $principal, integer $lifetime = 1, string $exclusive = Horde_Lock::TYPE_SHARED )
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.
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.
Parameters
- $requestor
- User ID of the lock requestor.
- $scope
- <p>The scope of the lock. Typically the name of
the application requesting the lock or some
other identifier used to group locks
together.</p>
- $principal
- <p>A principal on which a lock should be
granted. The format can be any string but is
suggested to be in URI form.</p>
- $lifetime
- <p>Time (in seconds) for which the lock will be
considered valid.</p>
- $exclusive
- <p>One of Horde_Lock::TYPE_SHARED or
Horde_Lock::TYPE_EXCLUSIVE.
- An exclusive lock will be enforced strictly
and must be interpreted to mean that the
resource can not be modified. Only one
exclusive lock per principal is allowed.
- A shared lock is one that notifies other
potential lock requestors that the resource
is in use. This lock can be overridden
(cleared or replaced with a subsequent
call to setLock()) by other users. Multiple
users may request (and will be granted) a
shared lock on a given principal. All locks
will be considered valid until they are
cleared or expire.</p>
Returns
mixed A string lock ID.
Throws
|
public
boolean
|
#
clearLock( string $lockid )
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.
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.
Parameters
- $lockid
- <p>The lock ID as generated by a previous call
to setLock()</p>
Returns
boolean Returns true on success.
Throws
|