PHP code example of reactphp-x / redis-pool

1. Go to this page and download the library: Download reactphp-x/redis-pool library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

reactphp-x / redis-pool example snippets




eactphpX\Redis\Pool;
use function React\Async\await;


$pool = new Pool(getenv('REDIS_URL') ?: '127.0.0.1:6379', [
    'min_connections' => 2, // 2 connection
    'max_connections' => 10, // 10 connection
    'max_wait_queue' => 100, // how many sql in queue
    'wait_timeout' => 5, // wait time OL;
});

$pool->incr('invocation')->then(function (int $n) {
    echo 'This is invocation #' . $n . PHP_EOL;
});