forked from szado/php-resource-pool
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.php
More file actions
26 lines (20 loc) · 670 Bytes
/
test.php
File metadata and controls
26 lines (20 loc) · 670 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<?php
use Szado\React\ConnectionPool\ConnectionAdapters\ConnectionAdapterInterface;
use Szado\React\ConnectionPool\ConnectionPool;
use Szado\React\ConnectionPool\ConnectionState;
require 'vendor/autoload.php';
$pool = new ConnectionPool(function () {
return new class implements ConnectionAdapterInterface {
private ConnectionState $connectionState = ConnectionState::Busy;
public function getState(): ConnectionState
{
return $this->connectionState;
}
public function getConnection(): object
{
return new stdClass();
}
};
}, connectionsLimit: 1);
$pool->get();
$pool->get();