Download the PHP package libratechie/think-distributed-lock without Composer
On this page you can find all versions of the php package libratechie/think-distributed-lock. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download libratechie/think-distributed-lock
More information about libratechie/think-distributed-lock
Files in libratechie/think-distributed-lock
Download libratechie/think-distributed-lock
More information about libratechie/think-distributed-lock
Files in libratechie/think-distributed-lock
Vendor libratechie
Package think-distributed-lock
Short Description 一个专为 ThinkPHP 框架设计的轻量级分布式锁组件,帮助开发者轻松实现高并发场景下的资源互斥访问
License Apache-2.0
Package think-distributed-lock
Short Description 一个专为 ThinkPHP 框架设计的轻量级分布式锁组件,帮助开发者轻松实现高并发场景下的资源互斥访问
License Apache-2.0
Please rate this library. Is it a good library?
Informations about the package think-distributed-lock
think-distributed-lock
专为 ThinkPHP 框架设计的轻量级分布式锁组件,帮助开发者轻松实现高并发场景下的资源互斥访问。
特性
- 自动锁释放与防死锁机制
- 简单直观的 API 设计
- 完美适配 ThinkPHP 8.x
- 开箱即用的配置方案
安装
配置
在 config/distributed_lock.php 中配置(文件不存在时会自动创建):
使用指南
注意事项
-
异常处理
确保在 try-catch 块中进行业务操作,避免异常导致锁无法释放; -
不可重入锁
本项目当前不支持可重入锁机制。即同一线程在持有锁的情况下,无法再次获得该锁。请确保锁的使用符合这一约束; -
默认超时时间
锁资源的默认超时时间为60秒。如果在超时时间内没有释放锁,锁将自动过期并被释放; -
节点故障与锁资源释放
如果锁持有的节点发生故障或宕机,锁资源的释放可能会延迟。这意味着,在锁资源未释放之前,其他节点无法获得该锁。此期间的分布式锁将无法被任何节点使用,直到故障节点恢复或锁被手动释放; - PHP客户端的限制
目前,PHP客户端不具备类似于JavaRedisson
的自动监控机制,因此,PHP实现的分布式锁可能会面临锁超时后无法自动延长有效期的问题。我们也欢迎大家通过Pull Request参与贡献,帮助改进这一特性。
免责声明
在您的生产环境中使用本项目之前,请确保了解其工作原理,并在充分测试后再进行部署。我们不对因使用本项目造成的任何损失或故障负责。
贡献
欢迎通过 Issue 提交问题或 Pull Request 参与贡献
All versions of think-distributed-lock with dependencies
PHP Build Version
Package Version
The package libratechie/think-distributed-lock contains the following files
Loading the files please wait ....