diff --git a/src/Core/KeyValueStorage/Factory/KeyValueStorage.php b/src/Core/KeyValueStorage/Factory/KeyValueStorage.php new file mode 100644 index 000000000..1bce84f4e --- /dev/null +++ b/src/Core/KeyValueStorage/Factory/KeyValueStorage.php @@ -0,0 +1,34 @@ +. + * + */ + +namespace Friendica\Core\KeyValueStorage\Factory; + +use Friendica\Core\Hooks\Capabilities\ICanCreateInstances; +use Friendica\Core\KeyValueStorage\Capabilities\IManageKeyValuePairs; + +class KeyValueStorage +{ + public function create(ICanCreateInstances $instanceCreator): IManageKeyValuePairs + { + /** @var IManageKeyValuePairs */ + return $instanceCreator->create(IManageKeyValuePairs::class, ''); + } +} diff --git a/src/Core/Lock/Type/AbstractLock.php b/src/Core/Lock/Type/AbstractLock.php index 3c47c0171..25eb47fe9 100644 --- a/src/Core/Lock/Type/AbstractLock.php +++ b/src/Core/Lock/Type/AbstractLock.php @@ -36,7 +36,7 @@ abstract class AbstractLock implements ICanLock /** * Check if we've locally acquired a lock * - * @param string key The Name of the lock + * @param string $key The Name of the lock * * @return bool Returns true if the lock is set */ diff --git a/static/dependencies.config.php b/static/dependencies.config.php index c3f30ad8d..9c1ead905 100644 --- a/static/dependencies.config.php +++ b/static/dependencies.config.php @@ -291,7 +291,10 @@ return [ ], ], \Friendica\Core\KeyValueStorage\Capabilities\IManageKeyValuePairs::class => [ - 'instanceOf' => \Friendica\Core\KeyValueStorage\Type\DBKeyValueStorage::class, + 'instanceOf' => \Friendica\Core\KeyValueStorage\Factory\KeyValueStorage::class, + 'call' => [ + ['create', [], Dice::CHAIN_CALL], + ], ], Network\HTTPClient\Capability\ICanSendHttpRequests::class => [ 'instanceOf' => Network\HTTPClient\Factory\HttpClient::class, diff --git a/static/strategies.config.php b/static/strategies.config.php index 5d84a7e47..35afe2e51 100644 --- a/static/strategies.config.php +++ b/static/strategies.config.php @@ -21,6 +21,7 @@ use Friendica\Core\Cache; use Friendica\Core\Logger\Type; +use Friendica\Core\KeyValueStorage; use Psr\Log; return [ @@ -35,5 +36,8 @@ return [ Cache\Type\MemcacheCache::class => ['memcache'], Cache\Type\MemcachedCache::class => ['memcached'], Cache\Type\RedisCache::class => ['redis'], - ] + ], + KeyValueStorage\Capabilities\IManageKeyValuePairs::class => [ + KeyValueStorage\Type\DBKeyValueStorage::class => ['database', ''], + ], ];