sjdskl / dbpool
此包最新版本(0.4)的许可信息不可用。
数据库连接池
0.4
2018-03-13 09:09 UTC
Requires
- php: >=7.0
- catfan/medoo: ^V1.5.5
- symfony/console: ^3.2
Requires (Dev)
- phpunit/phpunit: ^4.0
This package is not auto-updated.
Last update: 2024-09-29 05:14:51 UTC
README
基于多线程数据库连接池
- pthread 扩展
- php >= 7.2
特性
- 使用的 DB 驱动为 catfan/medoo,您可以在客户端调用其方法,就像本地调用一样
- 链式调用
- 非常易于使用
$client = DbPool\Client\DbPoolClient::getInstance('127.0.0.1', AF_INET, 1122);
for($i = 0; $i < 10; $i ++) {
$res = $client->query('select * from test.bairong where id=' . ($i + 1) . ' limit 1;')->fetchAll(\PDO::FETCH_ASSOC)->excute();
print_r($res);
}
$res = $client->select('bairong', ['id', 'realname', 'phone'], ['id[<=]' => 10])->excute();
- 两个连接代码可以运行服务器
$server = new \DbPool\Server\DbPoolServer('127.0.0.1', AF_INET, 1122);
//$server = new \DbPool\Server\DbPoolServer('/tmp/skl.sock', AF_UNIX);
$server->loop();
5. 支持事务
$client->action(function() use ($client) {
$client->update('bairong', ['realname' => '你大爷xxxx'], [
'id' => 1,
])->excute();
//true -> ommit,false -> rollback, just like medoo
return true;
});
6. 支持数据库连接心跳
public static $HeartBeatTime = 600;
public static $HeartBeatCheckTime = 60;
7. 自定义消息事件
8. 支持AES和RSA加密