shlink/config/autoload/locks.global.php

48 lines
1.4 KiB
PHP
Raw Normal View History

<?php
2019-10-05 18:26:10 +03:00
declare(strict_types=1);
2020-01-01 23:11:53 +03:00
use Laminas\ServiceManager\AbstractFactory\ConfigAbstractFactory;
use Predis\ClientInterface as PredisClient;
use Shlinkio\Shlink\Common\Logger\LoggerAwareDelegatorFactory;
use Symfony\Component\Lock;
use function Shlinkio\Shlink\Common\env;
use const Shlinkio\Shlink\Core\LOCAL_LOCK_FACTORY;
return [
'locks' => [
'locks_dir' => __DIR__ . '/../../data/locks',
],
'dependencies' => [
'factories' => [
Lock\Store\FlockStore::class => ConfigAbstractFactory::class,
Lock\Store\RedisStore::class => ConfigAbstractFactory::class,
2019-11-30 19:21:36 +03:00
Lock\LockFactory::class => ConfigAbstractFactory::class,
LOCAL_LOCK_FACTORY => ConfigAbstractFactory::class,
],
'aliases' => [
'lock_store' => env('REDIS_SERVERS') === null ? 'local_lock_store' : 'redis_lock_store',
'redis_lock_store' => Lock\Store\RedisStore::class,
'local_lock_store' => Lock\Store\FlockStore::class,
],
'delegators' => [
2019-11-30 19:21:36 +03:00
Lock\LockFactory::class => [
LoggerAwareDelegatorFactory::class,
],
],
],
ConfigAbstractFactory::class => [
Lock\Store\FlockStore::class => ['config.locks.locks_dir'],
Lock\Store\RedisStore::class => [PredisClient::class],
2019-11-30 19:21:36 +03:00
Lock\LockFactory::class => ['lock_store'],
LOCAL_LOCK_FACTORY => ['local_lock_store'],
],
];