TYPO3CMS  8
 All Classes Namespaces Files Functions Variables Pages
LockingStrategyInterface Interface Reference
Inheritance diagram for LockingStrategyInterface:
FileLockStrategy SemaphoreLockStrategy SimpleLockStrategy DummyLock

Public Member Functions

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

Static Public Member Functions

static getCapabilities ()
 
static getPriority ()
 

Public Attributes

const LOCK_CAPABILITY_EXCLUSIVE = 1
 
const LOCK_CAPABILITY_SHARED = 2
 
const LOCK_CAPABILITY_NOBLOCK = 4
 

Detailed Description

Interface for locking methods

Definition at line 24 of file LockingStrategyInterface.php.

Constructor & Destructor Documentation

__construct (   $subject)
Parameters
string$subjectID to identify this lock in the system
Exceptions
LockCreateExceptionif the lock could not be created

Implemented in SemaphoreLockStrategy, SimpleLockStrategy, FileLockStrategy, and DummyLock.

Member Function Documentation

acquire (   $mode = self::LOCK_CAPABILITY_EXCLUSIVE)

Try to acquire a lock

Parameters
int$modeLOCK_CAPABILITY_EXCLUSIVE or LOCK_CAPABILITY_SHARED
Returns
bool Returns TRUE if the lock was acquired successfully
Exceptions
LockAcquireExceptionif the lock could not be acquired
LockAcquireWouldBlockExceptionif the acquire would have blocked and NOBLOCK was set

Implemented in SimpleLockStrategy, SemaphoreLockStrategy, FileLockStrategy, and DummyLock.

destroy ( )

Destroys the resource associated with the lock

Returns
void

Implemented in SimpleLockStrategy, FileLockStrategy, SemaphoreLockStrategy, and DummyLock.

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

Implemented in FileLockStrategy, SimpleLockStrategy, SemaphoreLockStrategy, and DummyLock.

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

Implemented in SimpleLockStrategy, FileLockStrategy, SemaphoreLockStrategy, and DummyLock.

isAcquired ( )

Get status of this lock

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

Implemented in FileLockStrategy, SimpleLockStrategy, SemaphoreLockStrategy, and DummyLock.

release ( )

Release the lock

Returns
bool Returns TRUE on success or FALSE on failure

Implemented in FileLockStrategy, SimpleLockStrategy, SemaphoreLockStrategy, and DummyLock.

Member Data Documentation

const LOCK_CAPABILITY_EXCLUSIVE = 1

Exclusive locks can be acquired

Definition at line 29 of file LockingStrategyInterface.php.

Referenced by TypoScriptFrontendController\acquireLock(), and LockFactoryTest\getLockerReturnsExpectedClass().

const LOCK_CAPABILITY_NOBLOCK = 4

Do not block when acquiring the lock

Definition at line 39 of file LockingStrategyInterface.php.

Referenced by TypoScriptFrontendController\acquireLock().

const LOCK_CAPABILITY_SHARED = 2

Shared locks can be acquired

Definition at line 34 of file LockingStrategyInterface.php.

Referenced by LockFactoryTest\getLockerReturnsExpectedClass().