2018-07-07 14:07:07 -04:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
|
|
namespace Friendica\Test\src\Core\Cache;
|
|
|
|
|
|
|
|
|
|
|
|
use Friendica\Core\Cache\CacheDriverFactory;
|
|
|
|
|
2018-07-07 14:35:42 -04:00
|
|
|
class MemcacheCacheDriverTest extends MemoryCacheTest
|
2018-07-07 14:07:07 -04:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @var \Friendica\Core\Cache\IMemoryCacheDriver
|
|
|
|
*/
|
|
|
|
private $cache;
|
|
|
|
|
|
|
|
protected function getInstance()
|
|
|
|
{
|
|
|
|
if (class_exists('Memcache')) {
|
|
|
|
try {
|
|
|
|
$this->cache = CacheDriverFactory::create('memcache');
|
|
|
|
} catch (\Exception $exception) {
|
2018-07-08 01:46:06 -04:00
|
|
|
throw new \Exception("Memcache - TestCase failed: " . $exception->getMessage(), $exception->getCode(), $exception);
|
2018-07-07 14:07:07 -04:00
|
|
|
}
|
|
|
|
return $this->cache;
|
|
|
|
} else {
|
|
|
|
$this->markTestSkipped('Memcache driver isn\'t available');
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public function tearDown()
|
|
|
|
{
|
|
|
|
if (class_exists('Memcache')) {
|
2018-07-07 14:35:42 -04:00
|
|
|
$this->cache->clear(false);
|
2018-07-07 14:07:07 -04:00
|
|
|
}
|
|
|
|
parent::tearDown();
|
|
|
|
}
|
|
|
|
}
|