TYPO3 CMS  TYPO3_7-6
TYPO3\CMS\Core\Locking\SimpleLockStrategy Class Reference
Inheritance diagram for TYPO3\CMS\Core\Locking\SimpleLockStrategy:
TYPO3\CMS\Core\Locking\LockingStrategyInterface

Public Member Functions

 __construct ($subject)
 
 init ($loops=0, $step=0)
 
 __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/locks/'
 
- Public Attributes inherited from TYPO3\CMS\Core\Locking\LockingStrategyInterface
const LOCK_CAPABILITY_EXCLUSIVE = 1
 
const LOCK_CAPABILITY_SHARED = 2
 
const LOCK_CAPABILITY_NOBLOCK = 4
 

Protected Attributes

 $filePath
 
 $isAcquired = false
 
 $loops = 150
 
 $step = 200
 

Detailed Description

Simple file locking

Definition at line 24 of file SimpleLockStrategy.php.

Constructor & Destructor Documentation

◆ __construct()

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

Implements TYPO3\CMS\Core\Locking\LockingStrategyInterface.

Definition at line 52 of file SimpleLockStrategy.php.

References TYPO3\CMS\Core\Utility\GeneralUtility\mkdir().

◆ __destruct()

TYPO3\CMS\Core\Locking\SimpleLockStrategy::__destruct ( )

Destructor: Releases lock automatically when instance is destroyed and release resources

Definition at line 87 of file SimpleLockStrategy.php.

References TYPO3\CMS\Core\Locking\SimpleLockStrategy\release().

Member Function Documentation

◆ acquire()

TYPO3\CMS\Core\Locking\SimpleLockStrategy::acquire (   $mode = self::LOCK_CAPABILITY_EXCLUSIVE)

Try to acquire a lock

Parameters
int$modeLOCK_CAPABILITY_EXCLUSIVE or self::LOCK_CAPABILITY_NOBLOCK
Returns
bool Returns TRUE if the lock was acquired successfully
Exceptions
LockAcquireWouldBlockException

Implements TYPO3\CMS\Core\Locking\LockingStrategyInterface.

Definition at line 142 of file SimpleLockStrategy.php.

References TYPO3\CMS\Core\Locking\SimpleLockStrategy\$isAcquired, TYPO3\CMS\Core\Locking\SimpleLockStrategy\$loops, TYPO3\CMS\Core\Utility\GeneralUtility\fixPermissions(), and TYPO3\CMS\Core\Locking\SimpleLockStrategy\isAcquired().

◆ destroy()

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

Destroys the resource associated with the lock

Returns
void

Implements TYPO3\CMS\Core\Locking\LockingStrategyInterface.

Definition at line 194 of file SimpleLockStrategy.php.

◆ getCapabilities()

static TYPO3\CMS\Core\Locking\SimpleLockStrategy::getCapabilities ( )
static
Returns
int LOCK_CAPABILITY_* elements combined with bit-wise OR

Implements TYPO3\CMS\Core\Locking\LockingStrategyInterface.

Definition at line 130 of file SimpleLockStrategy.php.

◆ getPriority()

static TYPO3\CMS\Core\Locking\SimpleLockStrategy::getPriority ( )
static
Returns
int Returns a priority for the method. 0 to 100, 100 is highest

Implements TYPO3\CMS\Core\Locking\LockingStrategyInterface.

Definition at line 184 of file SimpleLockStrategy.php.

◆ init()

TYPO3\CMS\Core\Locking\SimpleLockStrategy::init (   $loops = 0,
  $step = 0 
)
Parameters
int$loopsNumber of times a locked resource is tried to be acquired.
int$stepMilliseconds after lock acquire is retried. $loops * $step results in the maximum delay of a lock.
Returns
void

Definition at line 77 of file SimpleLockStrategy.php.

References TYPO3\CMS\Core\Locking\SimpleLockStrategy\$loops, and TYPO3\CMS\Core\Locking\SimpleLockStrategy\$step.

◆ isAcquired()

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

Get status of this lock

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

Implements TYPO3\CMS\Core\Locking\LockingStrategyInterface.

Definition at line 122 of file SimpleLockStrategy.php.

References TYPO3\CMS\Core\Locking\SimpleLockStrategy\$isAcquired.

Referenced by TYPO3\CMS\Core\Locking\SimpleLockStrategy\acquire(), and TYPO3\CMS\Core\Locking\SimpleLockStrategy\release().

◆ release()

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

Member Data Documentation

◆ $filePath

TYPO3\CMS\Core\Locking\SimpleLockStrategy::$filePath
protected

Definition at line 31 of file SimpleLockStrategy.php.

◆ $isAcquired

TYPO3\CMS\Core\Locking\SimpleLockStrategy::$isAcquired = false
protected

◆ $loops

TYPO3\CMS\Core\Locking\SimpleLockStrategy::$loops = 150
protected

◆ $step

TYPO3\CMS\Core\Locking\SimpleLockStrategy::$step = 200
protected

◆ FILE_LOCK_FOLDER