wyrihaximus / react-mutex-key-prefix
ReactPHP Mutex Key Prefix
2.0.0
2021-08-14 21:53 UTC
Requires
- php: ^7.4
- react/promise: ^2.8
- thecodingmachine/safe: ^1.3
- wyrihaximus/react-mutex-contracts: ^2
Requires (Dev)
This package is auto-updated.
Last update: 2024-09-04 22:18:28 UTC
README
安装
要通过Composer安装,请使用以下命令,它将自动检测最新版本并将其绑定到^
。
composer require wyrihaximus/react-mutex-key-prefix
使用方法
<?php use WyriHaximus\React\Mutex\KeyPrefix\Mutex; use WyriHaximus\React\Mutex\Memory; $upstreamMutex = new Memory(); // Using Memory as example here, but can also be Redis $mutex = new Mutex('prefix:', $upstreamMutex); // All keys are transparently prefixed with `prefix:` $lock = $mutex->acquire('key', 1.23); // In the mutex store, the key is `prefix:key`, but in the lock we return it's just `key`, always pass the lock back to the same mutex you got it from
许可证
MIT许可证 (MIT)
版权所有 (c) 2021 Cees-Jan Kiewiet
特此免费授予任何人获得此软件及其相关文档副本(“软件”)的权利,无需支付任何费用,包括但不限于使用、复制、修改、合并、发布、分发、再许可和/或销售软件副本,并允许向软件提供者提供软件的人这样做,前提是遵守以下条件
上述版权声明和本许可声明应包含在软件的所有副本或主要部分中。
软件按“原样”提供,不提供任何明示或暗示的保证,包括但不限于适销性、适用于特定目的和非侵权性保证。在任何情况下,作者或版权所有者均不对任何索赔、损害或其他责任负责,无论这些责任是基于合同、侵权或其他原因,无论这些责任是否与软件或其使用或其他方式有关。