1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
/* |
6
|
|
|
* This file is part of the Micro framework package. |
7
|
|
|
* |
8
|
|
|
* (c) Stanislau Komar <[email protected]> |
9
|
|
|
* |
10
|
|
|
* For the full copyright and license information, please view the LICENSE |
11
|
|
|
* file that was distributed with this source code. |
12
|
|
|
*/ |
13
|
|
|
|
14
|
|
|
namespace Micro\Plugin\Cache\Configuration\Adapter; |
15
|
|
|
|
16
|
|
|
use Micro\Framework\Kernel\Configuration\PluginRoutingKeyConfiguration; |
17
|
|
|
|
18
|
|
|
class CachePoolConfiguration extends PluginRoutingKeyConfiguration implements CachePoolConfigurationInterface |
19
|
|
|
{ |
20
|
|
|
public const CFG_ADAPTER_TYPE = 'MICRO_CACHE_%s_TYPE'; |
21
|
|
|
|
22
|
|
|
public const CFG_ADAPTER_TTL = 'MICRO_CACHE_%s_DEFAULT_TTL'; |
23
|
|
|
|
24
|
|
|
public const CFG_ADAPTER_VERSION = 'MICRO_CACHE_%s_VERSION'; |
25
|
|
|
|
26
|
|
|
public const CFG_ADAPTER_NAMESPACE = 'MICRO_CACHE_%s_NAMESPACE'; |
27
|
|
|
|
28
|
|
|
public const CFG_ADAPTER_DIR = 'MICRO_CACHE_%s_DIR'; |
29
|
|
|
|
30
|
|
|
public const CFG_ADAPTER_CONNECTION = 'MICRO_CACHE_%s_CONNECTION'; |
31
|
|
|
|
32
|
|
|
public const CFG_ADAPTER_STORE_SERIALIZED = 'MICRO_CACHE_%s_STORE_SERIALIZED'; |
33
|
|
|
|
34
|
|
|
public const CFG_MAX_ITEMS = 'MICRO_CACHE_%s_MSX_ITEMS'; |
35
|
|
|
|
36
|
4 |
|
public function getAdapterType(): string |
37
|
|
|
{ |
38
|
4 |
|
return mb_strtolower($this->get(self::CFG_ADAPTER_TYPE, null, false)); |
39
|
|
|
} |
40
|
|
|
|
41
|
5 |
|
public function getDefaultLifetime(): int |
42
|
|
|
{ |
43
|
5 |
|
return (int) $this->get(self::CFG_ADAPTER_TTL, 0, false); |
44
|
|
|
} |
45
|
|
|
|
46
|
2 |
|
public function getVersion(): string|null |
47
|
|
|
{ |
48
|
2 |
|
return (string) $this->get(self::CFG_ADAPTER_VERSION); |
49
|
|
|
} |
50
|
|
|
|
51
|
4 |
|
public function getNamespace(): string |
52
|
|
|
{ |
53
|
4 |
|
return (string) $this->get(self::CFG_ADAPTER_NAMESPACE, ''); |
54
|
|
|
} |
55
|
|
|
|
56
|
2 |
|
public function getDirectory(): string|null |
57
|
|
|
{ |
58
|
2 |
|
return $this->get(self::CFG_ADAPTER_DIR); |
59
|
|
|
} |
60
|
|
|
|
61
|
1 |
|
public function getConnectionName(): string |
62
|
|
|
{ |
63
|
1 |
|
return $this->get(self::CFG_ADAPTER_CONNECTION, null, false); |
64
|
|
|
} |
65
|
|
|
|
66
|
1 |
|
public function isStoreSerialized(): bool |
67
|
|
|
{ |
68
|
1 |
|
return (bool) $this->get(self::CFG_ADAPTER_STORE_SERIALIZED, true, false); |
69
|
|
|
} |
70
|
|
|
|
71
|
1 |
|
public function getMaxItems(): int |
72
|
|
|
{ |
73
|
1 |
|
return (int) $this->get(self::CFG_MAX_ITEMS, 0, false); |
74
|
|
|
} |
75
|
|
|
} |
76
|
|
|
|