TYPO3CMS  8
 All Classes Namespaces Files Functions Variables Pages
SemaphoreLockStrategy Class Reference
Inheritance diagram for SemaphoreLockStrategy:
LockingStrategyInterface

Public Member Functions

 __construct ($subject)
 
 __destruct ()
 
 release ()
 
 isAcquired ()
 
 acquire ($mode=self::LOCK_CAPABILITY_EXCLUSIVE)
 
 destroy ()
 

Static Public Member Functions

static getCapabilities ()
 
static getPriority ()
 

Public Attributes

const FILE_LOCK_FOLDER = 'typo3temp/var/locks/'
 
- Public Attributes inherited from LockingStrategyInterface
const LOCK_CAPABILITY_EXCLUSIVE = 1
 
const LOCK_CAPABILITY_SHARED = 2
 
const LOCK_CAPABILITY_NOBLOCK = 4
 

Protected Attributes

 $id
 
 $resource
 
 $filePath = ''
 
 $isAcquired = false
 

Detailed Description

Semaphore locking

Definition at line 24 of file SemaphoreLockStrategy.php.

Constructor & Destructor Documentation

__construct (   $subject)
Parameters
string$subjectID to identify this lock in the system
Exceptions
LockCreateException

Implements LockingStrategyInterface.

Definition at line 52 of file SemaphoreLockStrategy.php.

References GeneralUtility\mkdir().

__destruct ( )

Destructor

Definition at line 77 of file SemaphoreLockStrategy.php.

References SemaphoreLockStrategy\release().

Member Function Documentation

acquire (   $mode = self::LOCK_CAPABILITY_EXCLUSIVE)

Try to acquire a lock

Parameters
int$modeLOCK_CAPABILITY_EXCLUSIVE
Returns
bool Returns TRUE if the lock was acquired successfully
Exceptions
LockAcquireExceptionif a semaphore could not be retrieved

Implements LockingStrategyInterface.

Definition at line 129 of file SemaphoreLockStrategy.php.

References SemaphoreLockStrategy\$isAcquired, and SemaphoreLockStrategy\isAcquired().

destroy ( )

Destroys the resource associated with the lock

Returns
void

Implements LockingStrategyInterface.

Definition at line 157 of file SemaphoreLockStrategy.php.

static getCapabilities ( )
static
Returns
int LOCK_CAPABILITY_* elements combined with bit-wise OR

Implements LockingStrategyInterface.

Definition at line 114 of file SemaphoreLockStrategy.php.

Referenced by SemaphoreLockStrategyTest\setUp().

static getPriority ( )
static
Returns
int Returns a priority for the method. 0 to 100, 100 is highest

Implements LockingStrategyInterface.

Definition at line 147 of file SemaphoreLockStrategy.php.

isAcquired ( )

Get status of this lock

Returns
bool Returns TRUE if lock is acquired by this locker, FALSE otherwise

Implements LockingStrategyInterface.

Definition at line 106 of file SemaphoreLockStrategy.php.

References SemaphoreLockStrategy\$isAcquired.

Referenced by SemaphoreLockStrategy\acquire(), and SemaphoreLockStrategy\release().

release ( )

Release the lock

Returns
bool Returns TRUE on success or FALSE on failure

Implements LockingStrategyInterface.

Definition at line 92 of file SemaphoreLockStrategy.php.

References SemaphoreLockStrategy\isAcquired().

Referenced by SemaphoreLockStrategy\__destruct().

Member Data Documentation

$filePath = ''
protected

Definition at line 41 of file SemaphoreLockStrategy.php.

$id
protected

Definition at line 31 of file SemaphoreLockStrategy.php.

$isAcquired = false
protected
$resource
protected

Definition at line 36 of file SemaphoreLockStrategy.php.

const FILE_LOCK_FOLDER = 'typo3temp/var/locks/'

Definition at line 26 of file SemaphoreLockStrategy.php.