TYPO3 CMS  TYPO3_7-6
TYPO3\CMS\Core\Locking\LockingStrategyInterface Interface Reference
Inheritance diagram for TYPO3\CMS\Core\Locking\LockingStrategyInterface:
TYPO3\CMS\Core\Locking\FileLockStrategy TYPO3\CMS\Core\Locking\SemaphoreLockStrategy TYPO3\CMS\Core\Locking\SimpleLockStrategy TYPO3\CMS\Core\Tests\Unit\Locking\Fixtures\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()

TYPO3\CMS\Core\Locking\LockingStrategyInterface::__construct (   $subject)
Parameters
string$subjectID to identify this lock in the system
Exceptions
LockCreateExceptionif the lock could not be created

Implemented in TYPO3\CMS\Core\Locking\SemaphoreLockStrategy, TYPO3\CMS\Core\Locking\SimpleLockStrategy, TYPO3\CMS\Core\Locking\FileLockStrategy, and TYPO3\CMS\Core\Tests\Unit\Locking\Fixtures\DummyLock.

Member Function Documentation

◆ acquire()

TYPO3\CMS\Core\Locking\LockingStrategyInterface::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 TYPO3\CMS\Core\Locking\SimpleLockStrategy, TYPO3\CMS\Core\Locking\SemaphoreLockStrategy, TYPO3\CMS\Core\Locking\FileLockStrategy, and TYPO3\CMS\Core\Tests\Unit\Locking\Fixtures\DummyLock.

◆ destroy()

TYPO3\CMS\Core\Locking\LockingStrategyInterface::destroy ( )

◆ getCapabilities()

static TYPO3\CMS\Core\Locking\LockingStrategyInterface::getCapabilities ( )
static

◆ getPriority()

static TYPO3\CMS\Core\Locking\LockingStrategyInterface::getPriority ( )
static

◆ isAcquired()

TYPO3\CMS\Core\Locking\LockingStrategyInterface::isAcquired ( )

Get status of this lock

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

Implemented in TYPO3\CMS\Core\Locking\FileLockStrategy, TYPO3\CMS\Core\Locking\SimpleLockStrategy, TYPO3\CMS\Core\Locking\SemaphoreLockStrategy, and TYPO3\CMS\Core\Tests\Unit\Locking\Fixtures\DummyLock.

◆ release()

TYPO3\CMS\Core\Locking\LockingStrategyInterface::release ( )

Member Data Documentation

◆ LOCK_CAPABILITY_EXCLUSIVE

const TYPO3\CMS\Core\Locking\LockingStrategyInterface::LOCK_CAPABILITY_EXCLUSIVE = 1

◆ LOCK_CAPABILITY_NOBLOCK

const TYPO3\CMS\Core\Locking\LockingStrategyInterface::LOCK_CAPABILITY_NOBLOCK = 4

Do not block when acquiring the lock

Definition at line 39 of file LockingStrategyInterface.php.

Referenced by TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController\acquireLock().

◆ LOCK_CAPABILITY_SHARED

const TYPO3\CMS\Core\Locking\LockingStrategyInterface::LOCK_CAPABILITY_SHARED = 2

Shared locks can be acquired

Definition at line 34 of file LockingStrategyInterface.php.

Referenced by TYPO3\CMS\Core\Tests\Unit\Locking\LockFactoryTest\getLockerReturnsExpectedClass().