mirror of
https://github.com/friendica/friendica
synced 2024-12-29 04:02:20 +00:00
40 lines
729 B
PHP
40 lines
729 B
PHP
|
<?php
|
||
|
|
||
|
|
||
|
namespace Friendica\Test\src\Core\Cache;
|
||
|
|
||
|
|
||
|
use Friendica\Core\Cache\CacheDriverFactory;
|
||
|
|
||
|
class RedisCacheDriverTest extends CacheTest
|
||
|
{
|
||
|
/**
|
||
|
* @var \Friendica\Core\Cache\IMemoryCacheDriver
|
||
|
*/
|
||
|
private $cache;
|
||
|
|
||
|
protected function getInstance()
|
||
|
{
|
||
|
if (class_exists('Redis')) {
|
||
|
try {
|
||
|
$this->cache = CacheDriverFactory::create('redis');
|
||
|
} catch (\Exception $exception) {
|
||
|
print "Redis - TestCase failed: " . $exception->getMessage();
|
||
|
throw new \Exception();
|
||
|
}
|
||
|
return $this->cache;
|
||
|
} else {
|
||
|
$this->markTestSkipped('Redis driver isn\'t available');
|
||
|
return null;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public function tearDown()
|
||
|
{
|
||
|
if (class_exists('Redis')) {
|
||
|
$this->cache->clear();
|
||
|
}
|
||
|
parent::tearDown();
|
||
|
}
|
||
|
}
|