troodi/laravel-connection-pool
Composer 安装命令:
composer require troodi/laravel-connection-pool
包简介
Connection pooling for illuminate/database
README 文档
README
Laravel Connection Pool allows you to take advantage of Laravel's query builder and Eloquent ORM in an asynchronous environment. Perform concurrent database operations through a familiar fluent interface without having to worry about locking contention, let alone what connection you are using.
Note: This package is a work in progress and is unsafe for use in production.
Requirements
- PHP 7.4+ (CLI only)
- Swoole PHP extension
Installation
composer require x/laravel-connection-pool
Usage
// concurrent operations go(fn () => Server::where('terminated_at', '<=', now()->subMinutes(5))->delete()); go(function () { Session::where('active', true)->get()->each(function ($session) { // }); }); Swoole\Event::wait();
// run 100 SLEEP(1) queries at once, takes ~1s for ($i = 0; $i < 100; $i++) { go(fn () => DB::statement('SELECT SLEEP(1)')); } Swoole\Event::wait();
统计信息
- 总下载量: 1
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2022-09-05