1 | <?php |
||
7 | class CacheConfig { |
||
8 | |||
9 | /** |
||
10 | * @const int |
||
11 | */ |
||
12 | const CACHE_UNTIL_MIDNIGHT = -1; |
||
13 | |||
14 | /** |
||
15 | * @const string |
||
16 | */ |
||
17 | const DEFAULT_CACHE_KEY = 'curr-curr-cache'; |
||
18 | |||
19 | /** |
||
20 | * @var CacheInterface |
||
21 | */ |
||
22 | private $cache; |
||
23 | |||
24 | /** |
||
25 | * @var int |
||
26 | */ |
||
27 | private $cacheTimeInSeconds; |
||
28 | |||
29 | /** |
||
30 | * @var string |
||
31 | */ |
||
32 | private $cacheKey; |
||
33 | |||
34 | /** |
||
35 | * CacheConfig constructor. |
||
36 | * |
||
37 | * @param CacheInterface $cache PSR-16 compliant CacheInterface implementation |
||
38 | * @param int $cacheTimeInSeconds TTL in seconds |
||
39 | * @param string $cacheKey Key to use for caching |
||
40 | */ |
||
41 | public function __construct(CacheInterface $cache = null, |
||
49 | |||
50 | /** |
||
51 | * @return CacheInterface |
||
52 | */ |
||
53 | public function getCache(): CacheInterface |
||
57 | |||
58 | /** |
||
59 | * @param CacheInterface $cache |
||
60 | */ |
||
61 | public function setCache(CacheInterface $cache) |
||
65 | |||
66 | /** |
||
67 | * @return int |
||
68 | */ |
||
69 | public function getCacheTimeInSeconds(): int |
||
73 | |||
74 | /** |
||
75 | * @param int $cacheTimeInSeconds |
||
76 | */ |
||
77 | public function setCacheTimeInSeconds(int $cacheTimeInSeconds) |
||
81 | |||
82 | /** |
||
83 | * @return string |
||
84 | */ |
||
85 | public function getCacheKey(): string |
||
89 | |||
90 | /** |
||
91 | * @param string $cacheKey |
||
92 | */ |
||
93 | public function setCacheKey(string $cacheKey) |
||
97 | |||
98 | } |