/**
  * @inheritdoc
  */
 protected function setUp()
 {
     static::$Redis->flushall();
     static::$fields = ['string' => 'value', 'integer' => 42, 'true' => true, 'false' => false, 'float' => 3.14159265, 'e' => '5.0e3', 'null' => null, '' => 'empty', 'empty' => '', 'bin' => call_user_func_array('pack', ['N*'] + range(0, 255))];
     static::$Redis->hmset('hash', static::$fields);
     static::$Redis->hmset('', static::$fields);
     static::$Redis->set('string', 'value');
 }
 public function test_defaultDatabase()
 {
     $Redis = new RedisClient2x6(['server' => TEST_REDIS_SERVER_2x6_1]);
     $Redis->flushall();
     for ($i = 0; $i <= 7; ++$i) {
         $this->assertTrue($Redis->select($i));
         $this->assertTrue($Redis->set('db', $i));
     }
     for ($i = 0; $i <= 7; ++$i) {
         $Redis = new RedisClient2x6(['server' => TEST_REDIS_SERVER_2x6_1, 'database' => $i]);
         $this->assertEquals($i, $Redis->get('db'));
     }
 }
 * Create a new instance of RedisClient
 */
namespace Examples;

require dirname(__DIR__) . '/vendor/autoload.php';
// or require (dirname(__DIR__).'/src/autoloader.php');
use RedisClient\RedisClient;
use RedisClient\Client\Version\RedisClient2x6;
use RedisClient\ClientFactory;
// Example 1. Create new Instance with default config
$Redis = new RedisClient();
// By default, the client works with the latest stable version of Redis.
echo 'RedisClient: ' . $Redis->getSupportedVersion() . PHP_EOL;
echo 'Redis: ' . $Redis->info('Server')['redis_version'] . PHP_EOL;
// RedisClient: 3.2
// Redis: 3.0.3
// Example 2. Create new Instance with config
// By default, the client works with the latest stable version of Redis.
$Redis = new RedisClient(['server' => 'tcp://127.0.0.1:6387', 'timeout' => 2]);
echo 'RedisClient: ' . $Redis->getSupportedVersion() . PHP_EOL;
echo 'Redis: ' . $Redis->info('Server')['redis_version'] . PHP_EOL;
// RedisClient: 3.2
// Redis: 3.2.0
// Example 3. Create new Instance for Redis version 2.6.x with config
$Redis = new RedisClient2x6(['server' => 'tcp://127.0.0.1:6379', 'timeout' => 2]);
echo 'RedisClient: ' . $Redis->getSupportedVersion() . PHP_EOL;
// RedisClient: 2.6
// Example 4. Create new Instance for Redis version 2.8.x with config via factory
$Redis = ClientFactory::create(['server' => 'tcp://127.0.0.1:6379', 'timeout' => 2, 'version' => '2.8.24']);
echo 'RedisClient: ' . $Redis->getSupportedVersion() . PHP_EOL;
// RedisClient: 2.8
 /**
  * @inheritdoc
  */
 protected function setUp()
 {
     static::$Redis->flushall();
 }
 /**
  * @inheritdoc
  */
 protected function setUp()
 {
     static::$Redis->flushall();
     static::$Redis->scriptFlush();
 }