1 | <?php |
||
21 | class CachedManager implements SettingManagerInterface |
||
22 | { |
||
23 | /** |
||
24 | * @var CacheItemPoolInterface |
||
25 | */ |
||
26 | private $cache; |
||
27 | |||
28 | /** |
||
29 | * @var int|\DateInterval|null |
||
30 | */ |
||
31 | private $ttl = 0; |
||
32 | |||
33 | /** |
||
34 | * @var SettingManagerInterface |
||
35 | */ |
||
36 | private $decoratedManager; |
||
37 | |||
38 | public function __construct(SettingManagerInterface $manager, CacheItemPoolInterface $cache, $ttl = 0) |
||
44 | |||
45 | /** |
||
46 | * @param $section |
||
47 | * @param $key |
||
48 | * @param string|null $owner |
||
49 | * |
||
50 | * @return string |
||
51 | */ |
||
52 | private function getCacheKey($section, $key, ?string $owner = null) |
||
59 | |||
60 | /** |
||
61 | * {@inheritdoc} |
||
62 | */ |
||
63 | public function setSetting(string $section, string $key, $value, ?string $owner = null, $autoFlush = false): void |
||
77 | |||
78 | /** |
||
79 | * {@inheritdoc} |
||
80 | */ |
||
81 | public function getSetting(string $section, string $key, ?string $owner = null) |
||
97 | |||
98 | /** |
||
99 | * {@inheritdoc} |
||
100 | */ |
||
101 | public function flush(): void |
||
105 | |||
106 | /** |
||
107 | * {@inheritdoc} |
||
108 | */ |
||
109 | public function get(string $path, ?string $owner = null) |
||
115 | |||
116 | /** |
||
117 | * {@inheritdoc} |
||
118 | */ |
||
119 | public function set(string $path, $value, ?string $owner = null): void |
||
125 | } |
||
126 |
If you suppress an error, we recommend checking for the error condition explicitly: