2018-11-17 07:10:38 -06:00
|
|
|
<?php
|
2019-10-05 10:26:10 -05:00
|
|
|
|
2018-11-17 07:10:38 -06:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
2020-01-01 14:11:53 -06:00
|
|
|
use Laminas\ServiceManager\AbstractFactory\ConfigAbstractFactory;
|
2019-08-07 07:17:15 -05:00
|
|
|
use Shlinkio\Shlink\Common\Cache\RedisFactory;
|
2019-08-07 10:37:24 -05:00
|
|
|
use Shlinkio\Shlink\Common\Lock\RetryLockStoreDelegatorFactory;
|
2019-08-08 06:42:14 -05:00
|
|
|
use Shlinkio\Shlink\Common\Logger\LoggerAwareDelegatorFactory;
|
2018-11-17 07:10:38 -06:00
|
|
|
use Symfony\Component\Lock;
|
|
|
|
|
2020-03-22 11:42:56 -05:00
|
|
|
use const Shlinkio\Shlink\Core\LOCAL_LOCK_FACTORY;
|
2019-11-17 04:09:37 -06:00
|
|
|
|
2018-11-17 07:10:38 -06:00
|
|
|
return [
|
|
|
|
|
|
|
|
'locks' => [
|
|
|
|
'locks_dir' => __DIR__ . '/../../data/locks',
|
|
|
|
],
|
|
|
|
|
|
|
|
'dependencies' => [
|
|
|
|
'factories' => [
|
|
|
|
Lock\Store\FlockStore::class => ConfigAbstractFactory::class,
|
2019-08-07 07:17:15 -05:00
|
|
|
Lock\Store\RedisStore::class => ConfigAbstractFactory::class,
|
2019-11-30 10:21:36 -06:00
|
|
|
Lock\LockFactory::class => ConfigAbstractFactory::class,
|
2020-03-22 11:42:56 -05:00
|
|
|
LOCAL_LOCK_FACTORY => ConfigAbstractFactory::class,
|
2018-11-17 07:10:38 -06:00
|
|
|
],
|
2019-08-07 07:17:15 -05:00
|
|
|
'aliases' => [
|
|
|
|
// With this config, a user could alias 'lock_store' => 'redis_lock_store' to override the default
|
2019-11-17 04:09:37 -06:00
|
|
|
'lock_store' => 'local_lock_store',
|
|
|
|
|
2019-08-07 07:17:15 -05:00
|
|
|
'redis_lock_store' => Lock\Store\RedisStore::class,
|
2019-11-17 04:09:37 -06:00
|
|
|
'local_lock_store' => Lock\Store\FlockStore::class,
|
2019-08-07 07:17:15 -05:00
|
|
|
],
|
2019-08-07 10:37:24 -05:00
|
|
|
'delegators' => [
|
|
|
|
Lock\Store\RedisStore::class => [
|
|
|
|
RetryLockStoreDelegatorFactory::class,
|
|
|
|
],
|
2019-11-30 10:21:36 -06:00
|
|
|
Lock\LockFactory::class => [
|
2019-08-08 06:42:14 -05:00
|
|
|
LoggerAwareDelegatorFactory::class,
|
|
|
|
],
|
2019-08-07 10:37:24 -05:00
|
|
|
],
|
2018-11-17 07:10:38 -06:00
|
|
|
],
|
|
|
|
|
|
|
|
ConfigAbstractFactory::class => [
|
|
|
|
Lock\Store\FlockStore::class => ['config.locks.locks_dir'],
|
2019-08-07 07:17:15 -05:00
|
|
|
Lock\Store\RedisStore::class => [RedisFactory::SERVICE_NAME],
|
2019-11-30 10:21:36 -06:00
|
|
|
Lock\LockFactory::class => ['lock_store'],
|
2020-03-22 11:42:56 -05:00
|
|
|
LOCAL_LOCK_FACTORY => ['local_lock_store'],
|
2018-11-17 07:10:38 -06:00
|
|
|
],
|
|
|
|
|
|
|
|
];
|