PHP code example of shen2 / easy-redis

1. Go to this page and download the library: Download shen2/easy-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/ */

    

shen2 / easy-redis example snippets




$config = array(
	'host'		=> 'localhost',
	'port'		=> 6379,
	'persistent'=> false,
	'database'	=> 0,
	'profiler'	=> true,
);

// Create a connection.
$redisManager = new EasyRedis\Manager($config);

// send request synchronously.
$redisManager->send('set', ['a', 'abc']);
echo $redisManager->send('get', ['a']) . "\n";

// send request asynchronously
$redisManager->sendAsync('set', ['a', 'abc']);

$redisManager->sendAsync('set', ['b', '123'])->then(function(){
    echo "successed.\n";
});