sacred/prevent-race-condition
最新稳定版本:1.0.2
Composer 安装命令:
composer require sacred/prevent-race-condition
包简介
This package allows you to lock some part of code to prevent race condition.
README 文档
README
This package allows you to lock some part of code to prevent race condition.
Install
composer require sacred/prevent-race-condition
Basic usage
You need PSR-6 or PSR-16 cache to use this
use PreventRaceCondition\RaceConditionFactory; // $somePSR16Cache is PSR16 any cache instance $raceCondition = RaceConditionFactory::fromCacheItemPool($somePSR16Cache); // or // $somePSR6Cache is PSR6 any cache instance $raceCondition = RaceConditionFactory::fromSimpleCache($somePSR6Cache); while($raceCondition->isBusy('lock-name')) { // wait or do something else } $raceCondition->lock('lock-name'); // do something $raceCondition->release('lock-name');
统计信息
- 总下载量: 2
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-11-19