PHP Класс yii\mutex\FileMutex
This component relies on PHP
flock() function.
Application configuration example:
[
'components' => [
'mutex' => [
'class' => 'yii\mutex\FileMutex'
],
],
]
Note: this component can maintain the locks only for the single web server,
it probably will not suffice to your in case you are using cloud server solution.
Warning: due to
flock() function nature this component is unreliable when
using a multithreaded server API like ISAPI.
Показать файл
Открыть проект
Примеры использования класса
Открытые свойства
Свойство |
Тип |
Описание |
|
$dirMode |
|
the permission to be set for newly created directories.
This value will be used by PHP chmod() function. No umask will be applied.
Defaults to 0775, meaning the directory is read-writable by owner and group,
but read-only for other users. |
|
$fileMode |
|
the permission to be set for newly created mutex files.
This value will be used by PHP chmod() function. No umask will be applied.
If not set, the permission will be determined by the current environment. |
|
$mutexPath |
|
the directory to store mutex files. You may use path alias here.
Defaults to the "mutex" subdirectory under the application runtime path. |
|
Открытые методы
Метод |
Описание |
|
init ( ) |
Initializes mutex component implementation dedicated for UNIX, GNU/Linux, Mac OS X, and other UNIX-like
operating systems. |
|
Защищенные методы
Описание методов
acquireLock()
защищенный метод
Acquires lock by given name.
getLockFilePath()
защищенный метод
Generate path for lock file.
Initializes mutex component implementation dedicated for UNIX, GNU/Linux, Mac OS X, and other UNIX-like
operating systems.
releaseLock()
защищенный метод
Releases lock by given name.
Описание свойств
$dirMode публичное свойство
the permission to be set for newly created directories.
This value will be used by PHP chmod() function. No umask will be applied.
Defaults to 0775, meaning the directory is read-writable by owner and group,
but read-only for other users.
$fileMode публичное свойство
the permission to be set for newly created mutex files.
This value will be used by PHP chmod() function. No umask will be applied.
If not set, the permission will be determined by the current environment.
$mutexPath публичное свойство
the directory to store mutex files. You may use path alias here.
Defaults to the "mutex" subdirectory under the application runtime path.