swordev/mutex
Composer 安装命令:
composer require swordev/mutex
包简介
Read-write concurrency control
README 文档
README
Read-write concurrency control
Installation
composer require @swordev/mutex
Usage
File read/write lock
use Swordev\Mutex\FileMutex; $mutex1 = new FileMutex('key'); $mutex2 = new FileMutex('key'); $mutex1->readLock(); // true $mutex2->writeLock(); // false $mutex1->unlock(); // true $mutex2->writeLock(); // true
Timeout
use Swordev\Mutex\FileMutex; $mutex = new FileMutex('key'); $mutex->writeLock(5000);
Contextual lock
use Swordev\Mutex\FileMutex; class Foo { function method() { $mutex = new FileMutex(__CLASS__ . '|' . __FUNCTION__); $mutex->writeLock(); // ... } }
Mutex factory
use Swordev\Mutex\MutexFactory; $mutex = new MutexFactory::create(FileMutex::class, 'key');
Development
Test
composer run test
Analyse
composer run analyse
Author
Juanra GM - https://github.com/juanrgm
Distributed under the MIT license.
统计信息
- 总下载量: 3
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-07-27