PHP 클래스 yii\mutex\Mutex

This is achieved by using a "lock" mechanism. Each possibly concurrent thread cooperates by acquiring a lock before accessing the corresponding data. Usage example: if ($mutex->acquire($mutexName)) { business logic execution } else { execution is blocked! } This is a base class, which should be extended in order to implement the actual lock mechanism.
부터: 2.0
저자: resurtm ([email protected])
상속: extends yii\base\Component
파일 보기 프로젝트 열기: yiisoft/yii2 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$autoRelease whether all locks acquired in this process (i.e. local locks) must be released automatically before finishing script execution. Defaults to true. Setting this property to true means that all locks acquired in this process must be released (regardless of errors or exceptions).

공개 메소드들

메소드 설명
acquire ( string $name, integer $timeout ) : boolean Acquires a lock by name.
init ( ) Initializes the Mutex component.
release ( string $name ) : boolean Releases acquired lock. This method will return false in case the lock was not found.

보호된 메소드들

메소드 설명
acquireLock ( string $name, integer $timeout ) : boolean This method should be extended by a concrete Mutex implementations. Acquires lock by name.
releaseLock ( string $name ) : boolean This method should be extended by a concrete Mutex implementations. Releases lock by given name.

메소드 상세

acquire() 공개 메소드

Acquires a lock by name.
public acquire ( string $name, integer $timeout ) : boolean
$name string of the lock to be acquired. Must be unique.
$timeout integer time to wait for lock to be released. Defaults to zero meaning that method will return false immediately in case lock was already acquired.
리턴 boolean lock acquiring result.

acquireLock() 추상적인 보호된 메소드

This method should be extended by a concrete Mutex implementations. Acquires lock by name.
abstract protected acquireLock ( string $name, integer $timeout ) : boolean
$name string of the lock to be acquired.
$timeout integer time to wait for the lock to be released.
리턴 boolean acquiring result.

init() 공개 메소드

Initializes the Mutex component.
public init ( )

release() 공개 메소드

Releases acquired lock. This method will return false in case the lock was not found.
public release ( string $name ) : boolean
$name string of the lock to be released. This lock must already exist.
리턴 boolean lock release result: false in case named lock was not found..

releaseLock() 추상적인 보호된 메소드

This method should be extended by a concrete Mutex implementations. Releases lock by given name.
abstract protected releaseLock ( string $name ) : boolean
$name string of the lock to be released.
리턴 boolean release result.

프로퍼티 상세

$autoRelease 공개적으로 프로퍼티

whether all locks acquired in this process (i.e. local locks) must be released automatically before finishing script execution. Defaults to true. Setting this property to true means that all locks acquired in this process must be released (regardless of errors or exceptions).
public $autoRelease