1 | <?php |
||
21 | class GeneralConfigProvider implements GeneralConfigProviderInterface |
||
22 | { |
||
23 | /** |
||
24 | * @var string |
||
25 | */ |
||
26 | private const XML_PATH_CONCURRENT_REGENERATION = 'lm_varnish/general/max_concurrent_regeneration'; |
||
27 | private const XML_PATH_CONCURRENT_PURGE = 'lm_varnish/general/max_concurrent_purge'; |
||
28 | |||
29 | /** |
||
30 | * @var int |
||
31 | */ |
||
32 | private const REGENERATION_PROCESSES_DEFAULT = 10; |
||
33 | private const REGENERATION_PROCESSES_MAX = 20; |
||
34 | private const REGENERATION_PROCESSES_MIN = 1; |
||
35 | |||
36 | /** |
||
37 | * @var int |
||
38 | */ |
||
39 | private const PURGE_PROCESSES_DEFAULT = 4; |
||
40 | private const PURGE_PROCESSES_MAX = 20; |
||
41 | private const PURGE_PROCESSES_MIN = 1; |
||
42 | |||
43 | /** |
||
44 | * @var ScopeConfigInterface |
||
45 | */ |
||
46 | private $scopeConfig; |
||
47 | |||
48 | /** |
||
49 | * GeneralConfigProvider constructor. |
||
50 | * @param ScopeConfigInterface $scopeConfig |
||
51 | */ |
||
52 | public function __construct(ScopeConfigInterface $scopeConfig) |
||
56 | |||
57 | /** |
||
58 | * @return int |
||
59 | */ |
||
60 | public function getMaxConcurrentRegenerationProcesses(): int |
||
67 | |||
68 | /** |
||
69 | * @return int |
||
70 | */ |
||
71 | public function getMaxConcurrentPurgeProcesses(): int |
||
78 | |||
79 | /** |
||
80 | * @param int $configValue |
||
81 | * @return bool |
||
82 | */ |
||
83 | protected function isMaxRegenerationProcessesConfigValid(int $configValue): bool |
||
87 | |||
88 | /** |
||
89 | * @param int $configValue |
||
90 | * @return bool |
||
91 | */ |
||
92 | protected function isMaxPurgeProcessesConfigValid(int $configValue): bool |
||
96 | } |
||
97 |