Skip to content

reactphp-x/redis-pool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

reactphp-framework-redis-pool

install

composer require reactphp-x/redis-pool -vvv

Usage

<?php

require __DIR__ . '/../vendor/autoload.php';

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


$pool = new Pool(
    uri: getenv('REDIS_URL') ?: '127.0.0.1:6379',
    minConnections: 2,
    maxConnections: 10,
    waitQueue: 100,
    waitTimeout: 0,
);

// see https://github.com/clue/reactphp-redis?tab=readme-ov-file#quickstart-example
await($pool->set('greeting', 'Hello world'));
await($pool->append('greeting', '!'));

$pool->get('greeting')->then(function (string $greeting) {
    // Hello world!
    echo $greeting . PHP_EOL;
});

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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages