1. Go to this page and download the library: Download makise-co/redis 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/ */
makise-co / redis example snippets
declare(strict_types=1);
$pool = new \MakiseCo\Redis\RedisPool(
// pass standard redis extension connect parameters
\MakiseCo\Redis\ConnectionConfig::fromArray([
'host' => '127.0.0.1',
'port' => 6379,
'database' => 0,
// 'password' => 'secret',
'options' => [
\Redis::OPT_SERIALIZER => \Redis::SERIALIZER_MSGPACK,
]
]),
);
// initialize connection pool
$pool->init();
$pool->set('key', 'value');
$pool->del('key');
$pool
->multi()
->set('key', 'value')
->exec();
// However pool cannot be used as \Redis instance for this purpose you should use RedisLazyConnection
// RedisLazyConnection is a pool wrapper that extends \Redis class
$lazyConnection = new \MakiseCo\Redis\RedisLazyConnection($pool);
$lazyConnection->set('key', 'value');
$lazyConnection->del('key');
$lazyConnection
->multi()
->set('key', 'value')
->exec();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.