f3ath/flock
Composer 安装命令:
composer require f3ath/flock
包简介
Simple locking mechanism on top of flock()
README 文档
README
Flock. Simple locking mechanism on top of flock()
Usage
$file = '/tmp/my_lock.pid'; $lock = new F3\Flock\Lock($file); // Non-blocking case. Acquire lock if it's free, otherwse exit immediately if ($lock->acquire()) { // only one instance can reach here ... // do some job ... $lock->release(); } else { die('Another process is running') } // Waiting case. Acquire lock if it's free, otherwse block until it's free and then acquire if ($lock->acquire(F3\Flock\Lock::BLOCKING)) { // only one instance can reach here ... // do some job ... $lock->release(); } else { // We sould not get to this point in this case }
统计信息
- 总下载量: 348
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2014-04-15