use Asika\SimpleConsole\CommandArgsException;
use Friendica\App;
use Friendica\Core\Cache\ICache;
-use Friendica\Core\Config\Configuration;
-use Friendica\Factory\CacheDriverFactory;
use RuntimeException;
/**
return $help;
}
- public function __construct(App\Mode $appMode, Configuration $config, ICache $cache, array $argv = null)
+ public function __construct(App\Mode $appMode, ICache $cache, array $argv = null)
{
parent::__construct($argv);
$this->appMode = $appMode;
- $this->cache = $cache;
- $this->cacheDriverName = $config->get('system', 'cache_driver', CacheDriverFactory::DEFAULT_DRIVER);
+ $this->cache = $cache;
}
protected function doExecute()
}
if ($this->getOption('v')) {
- $this->out('Cache Driver Name: ' . $this->cacheDriverName);
+ $this->out('Cache Driver Name: ' . (string)$this->cache);
$this->out('Cache Driver Class: ' . get_class($this->cache));
}
private function executeList()
{
$prefix = $this->getArgument(1);
- $keys = $this->cache->getAllKeys($prefix);
+ $keys = $this->cache->getAllKeys($prefix);
if (empty($prefix)) {
$this->out('Listing all cache keys:');
private function executeGet()
{
if (count($this->args) >= 2) {
- $key = $this->getArgument(1);
+ $key = $this->getArgument(1);
$value = $this->cache->get($key);
$this->out("{$key} => " . var_export($value, true));
private function executeSet()
{
if (count($this->args) >= 3) {
- $key = $this->getArgument(1);
- $value = $this->getArgument(2);
+ $key = $this->getArgument(1);
+ $value = $this->getArgument(2);
$duration = intval($this->getArgument(3, ICache::FIVE_MINUTES));
if (is_array($this->cache->get($key))) {
return true;
}
+
+ public function __toString()
+ {
+ return self::TYPE_APCU;
+ }
}
*/
abstract class AbstractCache implements ICache
{
+ const TYPE_APCU = 'apcu';
+ const TYPE_ARRAY = 'array';
+ const TYPE_DATABASE = 'database';
+ const TYPE_MEMCACHE = 'memcache';
+ const TYPE_MEMCACHED = 'memcached';
+ const TYPE_REDIS = 'redis';
+
+ /**
+ * Force each Cache implementation to define the ToString method
+ *
+ * @return string
+ */
+ abstract function __toString();
+
/**
* @var string The hostname
*/
return false;
}
}
+
+ public function __toString()
+ {
+ return self::TYPE_ARRAY;
+ }
}
return $this->dba->delete('cache', ['`k` IS NOT NULL ']);
}
}
+
+ public function __toString()
+ {
+ return self::TYPE_DATABASE;
+ }
}
$cachekey = $this->getCacheKey($key);
return $this->memcache->add($cachekey, serialize($value), MEMCACHE_COMPRESSED, $ttl);
}
+
+ public function __toString()
+ {
+ return self::TYPE_MEMCACHE;
+ }
}
$cachekey = $this->getCacheKey($key);
return $this->memcached->add($cachekey, $value, $ttl);
}
+
+ public function __toString()
+ {
+ return self::TYPE_MEMCACHED;
+ }
}
return false;
}
}
+
+ public function __toString()
+ {
+ return (string)$this->cache . ' (with profiler)';
+ }
}
$this->redis->unwatch();
return false;
}
+
+ public function __toString()
+ {
+ return self::TYPE_REDIS;
+ }
}
--- /dev/null
+<?php
+
+namespace Friendica\Core\Lock;
+
+use Friendica\Core\Cache;
+use Friendica\Core\Cache\IMemoryCache;
+
+class CacheLock extends AbstractLock
+{
+ /**
+ * @var \Friendica\Core\Cache\ICache;
+ */
+ private $cache;
+
+ /**
+ * CacheLock constructor.
+ *
+ * @param IMemoryCache $cache The CacheDriver for this type of lock
+ */
+ public function __construct(IMemoryCache $cache)
+ {
+ $this->cache = $cache;
+ }
+
+ /**
+ * (@inheritdoc)
+ */
+ public function acquireLock($key, $timeout = 120, $ttl = Cache::FIVE_MINUTES)
+ {
+ $got_lock = false;
+ $start = time();
+
+ $cachekey = self::getLockKey($key);
+
+ do {
+ $lock = $this->cache->get($cachekey);
+ // When we do want to lock something that was already locked by us.
+ if ((int)$lock == getmypid()) {
+ $got_lock = true;
+ }
+
+ // When we do want to lock something new
+ if (is_null($lock)) {
+ // At first initialize it with "0"
+ $this->cache->add($cachekey, 0);
+ // Now the value has to be "0" because otherwise the key was used by another process meanwhile
+ if ($this->cache->compareSet($cachekey, 0, getmypid(), $ttl)) {
+ $got_lock = true;
+ $this->markAcquire($key);
+ }
+ }
+
+ if (!$got_lock && ($timeout > 0)) {
+ usleep(rand(10000, 200000));
+ }
+ } while (!$got_lock && ((time() - $start) < $timeout));
+
+ return $got_lock;
+ }
+
+ /**
+ * (@inheritdoc)
+ */
+ public function releaseLock($key, $override = false)
+ {
+ $cachekey = self::getLockKey($key);
+
+ if ($override) {
+ $return = $this->cache->delete($cachekey);
+ } else {
+ $return = $this->cache->compareDelete($cachekey, getmypid());
+ }
+ $this->markRelease($key);
+
+ return $return;
+ }
+
+ /**
+ * (@inheritdoc)
+ */
+ public function isLocked($key)
+ {
+ $cachekey = self::getLockKey($key);
+ $lock = $this->cache->get($cachekey);
+ return isset($lock) && ($lock !== false);
+ }
+
+ /**
+ * @param string $key The original key
+ *
+ * @return string The cache key used for the cache
+ */
+ private static function getLockKey($key)
+ {
+ return "lock:" . $key;
+ }
+}
+++ /dev/null
-<?php
-
-namespace Friendica\Core\Lock;
-
-use Friendica\Core\Cache;
-use Friendica\Core\Cache\IMemoryCache;
-
-class CacheLockDriver extends AbstractLock
-{
- /**
- * @var \Friendica\Core\Cache\ICache;
- */
- private $cache;
-
- /**
- * CacheLockDriver constructor.
- *
- * @param IMemoryCache $cache The CacheDriver for this type of lock
- */
- public function __construct(IMemoryCache $cache)
- {
- $this->cache = $cache;
- }
-
- /**
- * (@inheritdoc)
- */
- public function acquireLock($key, $timeout = 120, $ttl = Cache::FIVE_MINUTES)
- {
- $got_lock = false;
- $start = time();
-
- $cachekey = self::getLockKey($key);
-
- do {
- $lock = $this->cache->get($cachekey);
- // When we do want to lock something that was already locked by us.
- if ((int)$lock == getmypid()) {
- $got_lock = true;
- }
-
- // When we do want to lock something new
- if (is_null($lock)) {
- // At first initialize it with "0"
- $this->cache->add($cachekey, 0);
- // Now the value has to be "0" because otherwise the key was used by another process meanwhile
- if ($this->cache->compareSet($cachekey, 0, getmypid(), $ttl)) {
- $got_lock = true;
- $this->markAcquire($key);
- }
- }
-
- if (!$got_lock && ($timeout > 0)) {
- usleep(rand(10000, 200000));
- }
- } while (!$got_lock && ((time() - $start) < $timeout));
-
- return $got_lock;
- }
-
- /**
- * (@inheritdoc)
- */
- public function releaseLock($key, $override = false)
- {
- $cachekey = self::getLockKey($key);
-
- if ($override) {
- $return = $this->cache->delete($cachekey);
- } else {
- $return = $this->cache->compareDelete($cachekey, getmypid());
- }
- $this->markRelease($key);
-
- return $return;
- }
-
- /**
- * (@inheritdoc)
- */
- public function isLocked($key)
- {
- $cachekey = self::getLockKey($key);
- $lock = $this->cache->get($cachekey);
- return isset($lock) && ($lock !== false);
- }
-
- /**
- * @param string $key The original key
- *
- * @return string The cache key used for the cache
- */
- private static function getLockKey($key)
- {
- return "lock:" . $key;
- }
-}
+++ /dev/null
-<?php
-
-namespace Friendica\Factory;
-
-use Friendica\Core\Cache;
-use Friendica\Core\Cache\ICache;
-use Friendica\Core\Config\Configuration;
-use Friendica\Database\Database;
-use Friendica\Util\BaseURL;
-use Friendica\Util\Profiler;
-use Psr\Log\LoggerInterface;
-
-/**
- * Class CacheDriverFactory
- *
- * @package Friendica\Core\Cache
- *
- * A basic class to generate a CacheDriver
- */
-class CacheDriverFactory
-{
- /**
- * @var string The default driver for caching
- */
- const DEFAULT_DRIVER = 'database';
-
- /**
- * @var Configuration The configuration to read parameters out of the config
- */
- private $config;
-
- /**
- * @var Database The database connection in case that the cache is used the dba connection
- */
- private $dba;
-
- /**
- * @var string The hostname, used as Prefix for Caching
- */
- private $hostname;
-
- /**
- * @var Profiler The optional profiler if the cached should be profiled
- */
- private $profiler;
-
- /**
- * @var LoggerInterface The Friendica Logger
- */
- private $logger;
-
- public function __construct(BaseURL $baseURL, Configuration $config, Database $dba, Profiler $profiler, LoggerInterface $logger)
- {
- $this->hostname = $baseURL->getHostname();
- $this->config = $config;
- $this->dba = $dba;
- $this->profiler = $profiler;
- $this->logger = $logger;
- }
-
- /**
- * This method creates a CacheDriver for the given cache driver name
- *
- * @return ICache The instance of the CacheDriver
- * @throws \Exception The exception if something went wrong during the CacheDriver creation
- */
- public function create()
- {
- $driver = $this->config->get('system', 'cache_driver', self::DEFAULT_DRIVER);
-
- switch ($driver) {
- case 'memcache':
- $cache = new Cache\MemcacheCache($this->hostname, $this->config);
- break;
- case 'memcached':
- $cache = new Cache\MemcachedCache($this->hostname, $this->config, $this->logger);
- break;
- case 'redis':
- $cache = new Cache\RedisCache($this->hostname, $this->config);
- break;
- case 'apcu':
- $cache = new Cache\APCuCache($this->hostname);
- break;
- default:
- $cache = new Cache\DatabaseCache($this->hostname, $this->dba);
- }
-
- $profiling = $this->config->get('system', 'profiling', false);
-
- // In case profiling is enabled, wrap the ProfilerCache around the current cache
- if (isset($profiling) && $profiling !== false) {
- return new Cache\ProfilerCache($cache, $this->profiler);
- } else {
- return $cache;
- }
- }
-}
--- /dev/null
+<?php
+
+namespace Friendica\Factory;
+
+use Friendica\Core\Cache;
+use Friendica\Core\Cache\ICache;
+use Friendica\Core\Config\Configuration;
+use Friendica\Database\Database;
+use Friendica\Util\BaseURL;
+use Friendica\Util\Profiler;
+use Psr\Log\LoggerInterface;
+
+/**
+ * Class CacheFactory
+ *
+ * @package Friendica\Core\Cache
+ *
+ * A basic class to generate a CacheDriver
+ */
+class CacheFactory
+{
+ /**
+ * @var string The default cache if nothing set
+ */
+ const DEFAULT_TYPE = Cache\AbstractCache::TYPE_DATABASE;
+
+ /**
+ * @var Configuration The configuration to read parameters out of the config
+ */
+ private $config;
+
+ /**
+ * @var Database The database connection in case that the cache is used the dba connection
+ */
+ private $dba;
+
+ /**
+ * @var string The hostname, used as Prefix for Caching
+ */
+ private $hostname;
+
+ /**
+ * @var Profiler The optional profiler if the cached should be profiled
+ */
+ private $profiler;
+
+ /**
+ * @var LoggerInterface The Friendica Logger
+ */
+ private $logger;
+
+ public function __construct(BaseURL $baseURL, Configuration $config, Database $dba, Profiler $profiler, LoggerInterface $logger)
+ {
+ $this->hostname = $baseURL->getHostname();
+ $this->config = $config;
+ $this->dba = $dba;
+ $this->profiler = $profiler;
+ $this->logger = $logger;
+ }
+
+ /**
+ * This method creates a CacheDriver for the given cache driver name
+ *
+ * @param string $type The cache type to create (default is per config)
+ *
+ * @return ICache The instance of the CacheDriver
+ * @throws \Exception The exception if something went wrong during the CacheDriver creation
+ */
+ public function create(string $type = null)
+ {
+ if (empty($type)) {
+ $type = $this->config->get('system', 'cache_driver', self::DEFAULT_TYPE);
+ }
+
+ switch ($type) {
+ case Cache\AbstractCache::TYPE_MEMCACHE:
+ $cache = new Cache\MemcacheCache($this->hostname, $this->config);
+ break;
+ case Cache\AbstractCache::TYPE_MEMCACHED:
+ $cache = new Cache\MemcachedCache($this->hostname, $this->config, $this->logger);
+ break;
+ case Cache\AbstractCache::TYPE_REDIS:
+ $cache = new Cache\RedisCache($this->hostname, $this->config);
+ break;
+ case Cache\AbstractCache::TYPE_APCU:
+ $cache = new Cache\APCuCache($this->hostname);
+ break;
+ default:
+ $cache = new Cache\DatabaseCache($this->hostname, $this->dba);
+ }
+
+ $profiling = $this->config->get('system', 'profiling', false);
+
+ // In case profiling is enabled, wrap the ProfilerCache around the current cache
+ if (isset($profiling) && $profiling !== false) {
+ return new Cache\ProfilerCache($cache, $this->profiler);
+ } else {
+ return $cache;
+ }
+ }
+}
+++ /dev/null
-<?php
-
-namespace Friendica\Factory;
-
-use Friendica\Core\Cache\ICache;
-use Friendica\Core\Cache\IMemoryCache;
-use Friendica\Core\Config\Configuration;
-use Friendica\Core\Lock;
-use Friendica\Database\Database;
-use Friendica\Util\Profiler;
-use Psr\Log\LoggerInterface;
-
-/**
- * Class LockDriverFactory
- *
- * @package Friendica\Core\Cache
- *
- * A basic class to generate a LockDriver
- */
-class LockDriverFactory
-{
- /**
- * @var string The default driver for caching
- */
- const DEFAULT_DRIVER = 'default';
-
- /**
- * @var Configuration The configuration to read parameters out of the config
- */
- private $config;
-
- /**
- * @var Database The database connection in case that the cache is used the dba connection
- */
- private $dba;
-
- /**
- * @var ICache The memory cache driver in case we use it
- */
- private $cacheDriver;
-
- /**
- * @var Profiler The optional profiler if the cached should be profiled
- */
- private $profiler;
-
- /**
- * @var LoggerInterface The Friendica Logger
- */
- private $logger;
-
- public function __construct(ICache $cacheDriver, Configuration $config, Database $dba, Profiler $profiler, LoggerInterface $logger)
- {
- $this->cacheDriver = $cacheDriver;
- $this->config = $config;
- $this->dba = $dba;
- $this->logger = $logger;
- }
-
- public function create()
- {
- $lock_driver = $this->config->get('system', 'lock_driver', self::DEFAULT_DRIVER);
-
- try {
- switch ($lock_driver) {
- case 'memcache':
- case 'memcached':
- case 'redis':
- if ($this->cacheDriver instanceof IMemoryCache) {
- return new Lock\CacheLockDriver($this->cacheDriver);
- }
- break;
-
- case 'database':
- return new Lock\DatabaseLock($this->dba);
- break;
-
- case 'semaphore':
- return new Lock\SemaphoreLock();
- break;
-
- default:
- return self::useAutoDriver();
- }
- } catch (\Exception $exception) {
- $this->logger->alert('Driver \'' . $lock_driver . '\' failed - Fallback to \'useAutoDriver()\'', ['exception' => $exception]);
- return self::useAutoDriver();
- }
- }
-
- /**
- * @brief This method tries to find the best - local - locking method for Friendica
- *
- * The following sequence will be tried:
- * 1. Semaphore Locking
- * 2. Cache Locking
- * 3. Database Locking
- *
- * @return Lock\ILock
- */
- private function useAutoDriver()
- {
-
- // 1. Try to use Semaphores for - local - locking
- if (function_exists('sem_get')) {
- try {
- return new Lock\SemaphoreLock();
- } catch (\Exception $exception) {
- $this->logger->debug('Using Semaphore driver for locking failed.', ['exception' => $exception]);
- }
- }
-
- // 2. Try to use Cache Locking (don't use the DB-Cache Locking because it works different!)
- $cache_driver = $this->config->get('system', 'cache_driver', 'database');
- if ($cache_driver != 'database') {
- try {
- if ($this->cacheDriver instanceof IMemoryCache) {
- return new Lock\CacheLockDriver($this->cacheDriver);
- }
- } catch (\Exception $exception) {
- $this->logger->debug('Using Cache driver for locking failed.', ['exception' => $exception]);
- }
- }
-
- // 3. Use Database Locking as a Fallback
- return new Lock\DatabaseLock($this->dba);
- }
-}
--- /dev/null
+<?php
+
+namespace Friendica\Factory;
+
+use Friendica\Core\Cache\AbstractCache;
+use Friendica\Core\Cache\IMemoryCache;
+use Friendica\Core\Config\Configuration;
+use Friendica\Core\Lock;
+use Friendica\Database\Database;
+use Friendica\Util\Profiler;
+use Psr\Log\LoggerInterface;
+
+/**
+ * Class LockFactory
+ *
+ * @package Friendica\Core\Cache
+ *
+ * A basic class to generate a LockDriver
+ */
+class LockFactory
+{
+ /**
+ * @var string The default driver for caching
+ */
+ const DEFAULT_DRIVER = 'default';
+
+ /**
+ * @var Configuration The configuration to read parameters out of the config
+ */
+ private $config;
+
+ /**
+ * @var Database The database connection in case that the cache is used the dba connection
+ */
+ private $dba;
+
+ /**
+ * @var CacheFactory The memory cache driver in case we use it
+ */
+ private $cacheFactory;
+
+ /**
+ * @var Profiler The optional profiler if the cached should be profiled
+ */
+ private $profiler;
+
+ /**
+ * @var LoggerInterface The Friendica Logger
+ */
+ private $logger;
+
+ public function __construct(CacheFactory $cacheFactory, Configuration $config, Database $dba, Profiler $profiler, LoggerInterface $logger)
+ {
+ $this->cacheFactory = $cacheFactory;
+ $this->config = $config;
+ $this->dba = $dba;
+ $this->logger = $logger;
+ }
+
+ public function create()
+ {
+ $lock_type = $this->config->get('system', 'lock_driver', self::DEFAULT_DRIVER);
+
+ try {
+ switch ($lock_type) {
+ case AbstractCache::TYPE_MEMCACHE:
+ case AbstractCache::TYPE_MEMCACHED:
+ case AbstractCache::TYPE_REDIS:
+ case AbstractCache::TYPE_APCU:
+ $cache = $this->cacheFactory->create($lock_type);
+ if ($cache instanceof IMemoryCache) {
+ return new Lock\CacheLock($cache);
+ } else {
+ throw new \Exception(sprintf('Incompatible cache driver \'%s\' for lock used', $lock_type));
+ }
+ break;
+
+ case 'database':
+ return new Lock\DatabaseLock($this->dba);
+ break;
+
+ case 'semaphore':
+ return new Lock\SemaphoreLock();
+ break;
+
+ default:
+ return self::useAutoDriver();
+ }
+ } catch (\Exception $exception) {
+ $this->logger->alert('Driver \'' . $lock_type . '\' failed - Fallback to \'useAutoDriver()\'', ['exception' => $exception]);
+ return self::useAutoDriver();
+ }
+ }
+
+ /**
+ * @brief This method tries to find the best - local - locking method for Friendica
+ *
+ * The following sequence will be tried:
+ * 1. Semaphore Locking
+ * 2. Cache Locking
+ * 3. Database Locking
+ *
+ * @return Lock\ILock
+ */
+ private function useAutoDriver()
+ {
+ // 1. Try to use Semaphores for - local - locking
+ if (function_exists('sem_get')) {
+ try {
+ return new Lock\SemaphoreLock();
+ } catch (\Exception $exception) {
+ $this->logger->debug('Using Semaphore driver for locking failed.', ['exception' => $exception]);
+ }
+ }
+
+ // 2. Try to use Cache Locking (don't use the DB-Cache Locking because it works different!)
+ $cache_type = $this->config->get('system', 'cache_driver', 'database');
+ if ($cache_type != AbstractCache::TYPE_DATABASE) {
+ try {
+ $cache = $this->cacheFactory->create($cache_type);
+ if ($cache instanceof IMemoryCache) {
+ return new Lock\CacheLock($cache);
+ }
+ } catch (\Exception $exception) {
+ $this->logger->debug('Using Cache driver for locking failed.', ['exception' => $exception]);
+ }
+ }
+
+ // 3. Use Database Locking as a Fallback
+ return new Lock\DatabaseLock($this->dba);
+ }
+}
]
],
Cache\ICache::class => [
- 'instanceOf' => Factory\CacheDriverFactory::class,
+ 'instanceOf' => Factory\CacheFactory::class,
'call' => [
['create', [], Dice::CHAIN_CALL],
],
],
Cache\IMemoryCache::class => [
- 'instanceOf' => Cache\ICache::class,
+ 'instanceOf' => Factory\CacheFactory::class,
+ 'call' => [
+ ['create', [], Dice::CHAIN_CALL],
+ ],
],
ILock::class => [
- 'instanceOf' => Factory\LockDriverFactory::class,
+ 'instanceOf' => Factory\LockFactory::class,
'call' => [
['create', [], Dice::CHAIN_CALL],
],
use Dice\Dice;
use Friendica\App;
+use Friendica\Core\Cache\ICache;
+use Friendica\Core\Cache\IMemoryCache;
use Friendica\Core\Config\Cache\ConfigCache;
use Friendica\Core\Config\Configuration;
+use Friendica\Core\Lock\ILock;
use Friendica\Database\Database;
use Friendica\Test\Util\VFSTrait;
use Friendica\Util\BasePath;
/** @var LoggerInterface $logger */
$logger = $this->dice->create('$devLogger', ['dev']);
- self::assertInstanceOf(LoggerInterface::class, $logger);
+ $this->assertInstanceOf(LoggerInterface::class, $logger);
+ }
+
+ public function testCache()
+ {
+ /** @var ICache $cache */
+ $cache = $this->dice->create(ICache::class);
+
+ $this->assertInstanceOf(ICache::class, $cache);
+ }
+
+ public function testMemoryCache()
+ {
+ /** @var IMemoryCache $cache */
+ $cache = $this->dice->create(IMemoryCache::class);
+
+ // We need to check "just" ICache, because the default Cache is DB-Cache, which isn't a memorycache
+ $this->assertInstanceOf(ICache::class, $cache);
+ }
+
+ public function testLock()
+ {
+ /** @var ILock $cache */
+ $lock = $this->dice->create(ILock::class);
+
+ $this->assertInstanceOf(ILock::class, $lock);
}
}
namespace Friendica\Test\src\Core\Lock;
use Friendica\Core\Cache\APCuCache;
-use Friendica\Core\Lock\CacheLockDriver;
+use Friendica\Core\Lock\CacheLock;
class APCuCacheLockTest extends LockTest
{
protected function getInstance()
{
- return new CacheLockDriver(new APCuCache('localhost'));
+ return new CacheLock(new APCuCache('localhost'));
}
}
namespace Friendica\Test\src\Core\Lock;
use Friendica\Core\Cache\ArrayCache;
-use Friendica\Core\Lock\CacheLockDriver;
+use Friendica\Core\Lock\CacheLock;
class ArrayCacheLockTest extends LockTest
{
protected function getInstance()
{
- return new CacheLockDriver(new ArrayCache('localhost'));
+ return new CacheLock(new ArrayCache('localhost'));
}
public function testLockTTL()
use Friendica\Core\Cache\MemcacheCache;
use Friendica\Core\Config\Configuration;
-use Friendica\Core\Lock\CacheLockDriver;
+use Friendica\Core\Lock\CacheLock;
/**
* @requires extension Memcache
->with('system', 'memcache_port')
->andReturn(11211);
- return new CacheLockDriver(new MemcacheCache('localhost', $configMock));
+ return new CacheLock(new MemcacheCache('localhost', $configMock));
}
}
use Friendica\Core\Cache\MemcachedCache;
use Friendica\Core\Config\Configuration;
-use Friendica\Core\Lock\CacheLockDriver;
+use Friendica\Core\Lock\CacheLock;
use Psr\Log\NullLogger;
/**
$logger = new NullLogger();
- return new CacheLockDriver(new MemcachedCache('localhost', $configMock, $logger));
+ return new CacheLock(new MemcachedCache('localhost', $configMock, $logger));
}
}
use Friendica\Core\Cache\RedisCache;
use Friendica\Core\Config\Configuration;
-use Friendica\Core\Lock\CacheLockDriver;
+use Friendica\Core\Lock\CacheLock;
/**
* @requires extension redis
->with('system', 'redis_password')
->andReturn(null);
- return new CacheLockDriver(new RedisCache('localhost', $configMock));
+ return new CacheLock(new RedisCache('localhost', $configMock));
}
}