mirror of
https://github.com/friendica/friendica
synced 2025-04-22 21:10:10 +00:00
Refactor Cache/Lock to DICE
- Refactor Cache classes - Refactor Lock classes - Improved test speed (removed some seperate class annotations)
This commit is contained in:
parent
b95d4f41b9
commit
d56bd28a07
40 changed files with 766 additions and 621 deletions
|
@ -2,9 +2,9 @@
|
|||
|
||||
namespace Friendica\Core\Cache;
|
||||
|
||||
use Friendica\Core\Cache;
|
||||
|
||||
use Exception;
|
||||
use Friendica\Core\Cache;
|
||||
use Friendica\Core\Config\Configuration;
|
||||
use Memcache;
|
||||
|
||||
/**
|
||||
|
@ -23,18 +23,21 @@ class MemcacheCacheDriver extends AbstractCacheDriver implements IMemoryCacheDri
|
|||
private $memcache;
|
||||
|
||||
/**
|
||||
* @param string $memcache_host
|
||||
* @param int $memcache_port
|
||||
* @throws Exception
|
||||
*/
|
||||
public function __construct($memcache_host, $memcache_port)
|
||||
public function __construct(string $hostname, Configuration $config)
|
||||
{
|
||||
if (!class_exists('Memcache', false)) {
|
||||
throw new Exception('Memcache class isn\'t available');
|
||||
}
|
||||
|
||||
parent::__construct($hostname);
|
||||
|
||||
$this->memcache = new Memcache();
|
||||
|
||||
$memcache_host = $config->get('system', 'memcache_host');
|
||||
$memcache_port = $config->get('system', 'memcache_port');
|
||||
|
||||
if (!$this->memcache->connect($memcache_host, $memcache_port)) {
|
||||
throw new Exception('Expected Memcache server at ' . $memcache_host . ':' . $memcache_port . ' isn\'t available');
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue