-
-
Notifications
You must be signed in to change notification settings - Fork 448
Expand file tree
/
Copy pathRedisCluster.test.php
More file actions
35 lines (30 loc) · 1.21 KB
/
RedisCluster.test.php
File metadata and controls
35 lines (30 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
/**
*
* This file is part of Phpfastcache.
*
* @license MIT License (MIT)
*
* For full copyright and license information, please see the docs/CREDITS.txt and LICENCE files.
*
* @author Georges.L (Geolim4) <contact@geolim4.com>
* @author Contributors https://github.com/PHPSocialNetwork/phpfastcache/graphs/contributors
*/
use Phpfastcache\CacheManager;
use Phpfastcache\Tests\Helper\TestHelper;
use Phpfastcache\Drivers\Rediscluster\Config as RedisConfig;
chdir(__DIR__);
require_once __DIR__ . '/../../vendor/autoload.php';
$testHelper = new TestHelper('Redis cluster');
$testHelper->printText('[<blue>EXTENTION:</blue> (redis) <yellow>v' . \phpversion('redis') . '</yellow>]');
try {
$config = new RedisConfig();
$config->setClusters( '127.0.0.1:7001', '127.0.0.1:7002', '127.0.0.1:7003', '127.0.0.1:7004', '127.0.0.1:7005', '127.0.0.1:7006');
$config->setOptPrefix('pfc_');
$config->setSlaveFailover(\RedisCluster::FAILOVER_ERROR);
$cacheInstance = CacheManager::getInstance('RedisCluster', $config);
$testHelper->runCRUDTests($cacheInstance);
} catch (\RedisException $e) {
$testHelper->assertFail('A Redis exception occurred: ' . $e->getMessage());
}
$testHelper->terminateTest();