2018-11-17 14:10:38 +01:00
|
|
|
<?php
|
2019-10-05 17:26:10 +02:00
|
|
|
|
2018-11-17 14:10:38 +01:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
2020-01-01 21:11:53 +01:00
|
|
|
use Laminas\ServiceManager\AbstractFactory\ConfigAbstractFactory;
|
2022-07-25 18:23:13 +02:00
|
|
|
use Shlinkio\Shlink\Common\Cache\RedisFactory;
|
2023-09-12 21:20:38 +02:00
|
|
|
use Shlinkio\Shlink\Common\Lock\NamespacedStore;
|
2019-08-08 13:42:14 +02:00
|
|
|
use Shlinkio\Shlink\Common\Logger\LoggerAwareDelegatorFactory;
|
2022-01-20 20:16:37 +01:00
|
|
|
use Shlinkio\Shlink\Core\Config\EnvVars;
|
2018-11-17 14:10:38 +01:00
|
|
|
use Symfony\Component\Lock;
|
|
|
|
|
2021-09-26 11:20:29 +02:00
|
|
|
use const Shlinkio\Shlink\LOCAL_LOCK_FACTORY;
|
2019-11-17 11:09:37 +01:00
|
|
|
|
2018-11-17 14:10:38 +01:00
|
|
|
return [
|
|
|
|
|
|
|
|
'locks' => [
|
|
|
|
'locks_dir' => __DIR__ . '/../../data/locks',
|
|
|
|
],
|
|
|
|
|
|
|
|
'dependencies' => [
|
|
|
|
'factories' => [
|
|
|
|
Lock\Store\FlockStore::class => ConfigAbstractFactory::class,
|
2019-08-07 14:17:15 +02:00
|
|
|
Lock\Store\RedisStore::class => ConfigAbstractFactory::class,
|
2019-11-30 17:21:36 +01:00
|
|
|
Lock\LockFactory::class => ConfigAbstractFactory::class,
|
2020-03-22 17:42:56 +01:00
|
|
|
LOCAL_LOCK_FACTORY => ConfigAbstractFactory::class,
|
2023-09-12 21:20:38 +02:00
|
|
|
NamespacedStore::class => ConfigAbstractFactory::class,
|
2018-11-17 14:10:38 +01:00
|
|
|
],
|
2019-08-07 14:17:15 +02:00
|
|
|
'aliases' => [
|
2022-04-23 12:44:17 +02:00
|
|
|
'lock_store' => EnvVars::REDIS_SERVERS->existsInEnv() ? 'redis_lock_store' : 'local_lock_store',
|
2019-11-17 11:09:37 +01:00
|
|
|
|
2023-09-12 21:20:38 +02:00
|
|
|
'redis_lock_store' => NamespacedStore::class,
|
2019-11-17 11:09:37 +01:00
|
|
|
'local_lock_store' => Lock\Store\FlockStore::class,
|
2019-08-07 14:17:15 +02:00
|
|
|
],
|
2019-08-07 17:37:24 +02:00
|
|
|
'delegators' => [
|
2019-11-30 17:21:36 +01:00
|
|
|
Lock\LockFactory::class => [
|
2019-08-08 13:42:14 +02:00
|
|
|
LoggerAwareDelegatorFactory::class,
|
|
|
|
],
|
2019-08-07 17:37:24 +02:00
|
|
|
],
|
2018-11-17 14:10:38 +01:00
|
|
|
],
|
|
|
|
|
|
|
|
ConfigAbstractFactory::class => [
|
|
|
|
Lock\Store\FlockStore::class => ['config.locks.locks_dir'],
|
2022-07-25 18:23:13 +02:00
|
|
|
Lock\Store\RedisStore::class => [RedisFactory::SERVICE_NAME],
|
2023-09-12 21:20:38 +02:00
|
|
|
NamespacedStore::class => [Lock\Store\RedisStore::class, 'config.cache.namespace'],
|
|
|
|
|
2019-11-30 17:21:36 +01:00
|
|
|
Lock\LockFactory::class => ['lock_store'],
|
2020-03-22 17:42:56 +01:00
|
|
|
LOCAL_LOCK_FACTORY => ['local_lock_store'],
|
2018-11-17 14:10:38 +01:00
|
|
|
],
|
|
|
|
|
|
|
|
];
|