PHP Class Horde_Lock_Sql, horde

The table structure for the locks is as follows:
CREATE TABLE horde_locks (
    lock_id                  VARCHAR(36) NOT NULL,
    lock_owner               VARCHAR(32) NOT NULL,
    lock_scope               VARCHAR(32) NOT NULL,
    lock_principal           VARCHAR(255) NOT NULL,
    lock_origin_timestamp    BIGINT NOT NULL,
    lock_update_timestamp    BIGINT NOT NULL,
    lock_expiry_timestamp    BIGINT NOT NULL,
    lock_type                TINYINT NOT NULL,

    PRIMARY KEY (lock_id)
);
Copyright 2008-2016 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.
Author: Ben Klang ([email protected])
Inheritance: extends Horde_Lock
Show file Open project: horde/horde

Public Methods

Method Description
__construct ( array $params = [] ) Constructor.
clearLock ( $lockid ) Removes a lock given the lock ID.
doGC ( ) Do garbage collection needed for the driver.
getLockInfo ( $lockid ) Return an array of information about the requested lock.
getLocks ( $scope = null, $principal = null, $type = null ) Return a list of valid locks with the option to limit the results by principal, scope and/or type.
resetLock ( $lockid, $lifetime ) Extend the valid lifetime of a valid lock to now + $lifetime.
setLock ( $requestor, $scope, $principal, $lifetime = 1, $type = Horde_Lock::TYPE_SHARED ) Sets a lock on the requested principal and returns the generated lock ID.

Method Details

__construct() public method

Constructor.
public __construct ( array $params = [] )
$params array Parameters:
'db' - (Horde_Db_Adapter) [REQUIRED] The DB instance.
'table' - (string) The name of the lock table in 'database'.
          DEFAULT: 'horde_locks'

clearLock() public method

Removes a lock given the lock ID.
See also: Horde_Lock_Base::clearLock()
public clearLock ( $lockid )

doGC() public method

Do garbage collection needed for the driver.
public doGC ( )

getLockInfo() public method

Return an array of information about the requested lock.
See also: Horde_Lock_Base::getLockInfo()
public getLockInfo ( $lockid )

getLocks() public method

Return a list of valid locks with the option to limit the results by principal, scope and/or type.
See also: Horde_Lock_Base::getLocks()
public getLocks ( $scope = null, $principal = null, $type = null )

resetLock() public method

Extend the valid lifetime of a valid lock to now + $lifetime.
See also: Horde_Lock_Base::resetLock()
public resetLock ( $lockid, $lifetime )

setLock() public method

Sets a lock on the requested principal and returns the generated lock ID.
See also: Horde_Lock_Base::setLock()
public setLock ( $requestor, $scope, $principal, $lifetime = 1, $type = Horde_Lock::TYPE_SHARED )