1 | <?php |
||
13 | class CacheConfig |
||
14 | { |
||
15 | /** |
||
16 | * @const int |
||
17 | */ |
||
18 | public const CACHE_UNTIL_MIDNIGHT = -1; |
||
19 | |||
20 | /** |
||
21 | * @const string |
||
22 | */ |
||
23 | public const DEFAULT_CACHE_KEY = 'curr-curr-cache'; |
||
24 | |||
25 | /** |
||
26 | * @var CacheInterface |
||
27 | */ |
||
28 | private $cache; |
||
29 | |||
30 | /** |
||
31 | * @var int |
||
32 | */ |
||
33 | private $cacheTimeInSeconds; |
||
34 | |||
35 | /** |
||
36 | * @var string |
||
37 | */ |
||
38 | private $cacheKey; |
||
39 | |||
40 | /** |
||
41 | * CacheConfig constructor. |
||
42 | * |
||
43 | * @param CacheInterface $cache PSR-16 compliant CacheInterface implementation |
||
44 | * @param int $cacheTimeInSeconds TTL in seconds |
||
45 | * @param string $cacheKey Key to use for caching |
||
46 | */ |
||
47 | public function __construct( |
||
56 | |||
57 | /** |
||
58 | * @return CacheInterface |
||
59 | */ |
||
60 | public function getCache(): CacheInterface |
||
64 | |||
65 | /** |
||
66 | * @param CacheInterface $cache |
||
67 | */ |
||
68 | public function setCache(CacheInterface $cache) |
||
72 | |||
73 | /** |
||
74 | * @return int |
||
75 | */ |
||
76 | public function getCacheTimeInSeconds(): int |
||
80 | |||
81 | /** |
||
82 | * @param int $cacheTimeInSeconds |
||
83 | */ |
||
84 | public function setCacheTimeInSeconds(int $cacheTimeInSeconds) |
||
88 | |||
89 | /** |
||
90 | * @return string |
||
91 | */ |
||
92 | public function getCacheKey(): string |
||
96 | |||
97 | /** |
||
98 | * @param string $cacheKey |
||
99 | */ |
||
100 | public function setCacheKey(string $cacheKey) |
||
104 | } |