PHP Class malkusch\lock\mutex\SpinlockMutex

Author: Markus Malkusch ([email protected])
Inheritance: extends LockMutex
Datei anzeigen Open project: malkusch/lock Class Usage Examples

Public Methods

Method Description
__construct ( $name, integer $timeout = 3 ) Sets the timeout.

Protected Methods

Method Description
acquire ( string $key, integer $expire ) : boolean Tries to acquire a lock.
lock ( )
release ( string $key ) : boolean Tries to release a lock.
unlock ( )

Method Details

__construct() public method

Sets the timeout.
public __construct ( $name, integer $timeout = 3 )
$timeout integer The time in seconds a lock expires, default is 3.

acquire() abstract protected method

Tries to acquire a lock.
abstract protected acquire ( string $key, integer $expire ) : boolean
$key string The lock key.
$expire integer The timeout in seconds when a lock expires.
return boolean True, if the lock could be acquired.

lock() protected method

protected lock ( )

release() abstract protected method

Tries to release a lock.
abstract protected release ( string $key ) : boolean
$key string The lock key.
return boolean True, if the lock could be released.

unlock() protected method

protected unlock ( )