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
特此授予任何获得本软件及其相关文档副本(以下简称“软件”)的个人免费使用软件的权利,包括但不限于使用、复制、修改、合并、发布、分发、再许可和/或出售软件副本的权利,并允许软件提供方使用软件,但需遵守以下条件
上述版权声明和本许可声明应包含在软件的所有副本或主要部分中。
软件按“原样”提供,不提供任何形式的保证,无论是明示的、暗示的还是法律规定的,包括但不限于对适销性、特定用途的适用性和非侵权的保证。在任何情况下,作者或版权所有者均不对任何索赔、损害或其他责任负责,无论这些索赔、损害或其他责任是由于合同、侵权或其他原因引起的,无论是与软件或其使用或其它方式有关还是由其引起的。