yriveiro/php-fslock
最新稳定版本:3.0.1
Composer 安装命令:
composer require yriveiro/php-fslock
包简介
A simple lock implementation using flock.
关键字:
README 文档
README
A simple lock implementation using flock.
NOTE: to use php-backoff with PHP 5.x please use the lastet release of branch 2.x
Usage
use FSLock\FSLock; $lock = new FSLock('test'); if ($lock->acquire()) { // Critical code. $lock->release(); }
If you want to use a custom path to store the locks, you should instantiate the FSLock like that
$lock = new FSLock('test', '/tmp/');
API
acquire: Acquires the lock, returns true if the operation was successful otherwise the return is false.release: Releases the lock, returns true if the operation was successful otherwise the return is false.id: returns the lock id.getPath: returns the lock path
Install
The recommended way to install this package is through Composer.
composer require yriveiro/php-fslock:3.0.0
Tests
Tests are performed using the phpunit library, to run them:
php vendor/bin/phpunit tests
License
FSLock is licensed under MIT license.
统计信息
- 总下载量: 101.15k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 19
- 点击次数: 1
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2013-09-28