1 | <?php namespace Anomaly\Streams\Platform\View\Cache; |
||
15 | class CacheStrategy implements CacheStrategyInterface |
||
16 | { |
||
17 | |||
18 | /** |
||
19 | * The cache provider. |
||
20 | * |
||
21 | * @var CacheProviderInterface |
||
22 | */ |
||
23 | private $cache; |
||
24 | |||
25 | /** |
||
26 | * The key generator. |
||
27 | * |
||
28 | * @var KeyGeneratorInterface |
||
29 | */ |
||
30 | private $generator; |
||
31 | |||
32 | /** |
||
33 | * The default lifetime. |
||
34 | * |
||
35 | * @var int |
||
36 | */ |
||
37 | private $lifetime; |
||
38 | |||
39 | /** |
||
40 | * Create a new CacheStrategy instance. |
||
41 | * |
||
42 | * @param CacheProviderInterface $cache |
||
43 | * @param KeyGeneratorInterface $generator |
||
44 | * @param integer $lifetime |
||
45 | */ |
||
46 | public function __construct(CacheProviderInterface $cache, KeyGeneratorInterface $generator, $lifetime = 0) |
||
52 | |||
53 | /** |
||
54 | * Fetch the block for a given key. |
||
55 | * |
||
56 | * @param mixed $key |
||
57 | * |
||
58 | * @return string |
||
59 | */ |
||
60 | public function fetchBlock($key) |
||
68 | |||
69 | /** |
||
70 | * Generate a key for the value. |
||
71 | * |
||
72 | * @param string $annotation |
||
73 | * @param mixed $value |
||
74 | * |
||
75 | * @return mixed |
||
76 | */ |
||
77 | public function generateKey($annotation, $value) |
||
94 | |||
95 | /** |
||
96 | * Save the contents of a rendered block. |
||
97 | * |
||
98 | * @param mixed $key |
||
99 | * @param string $block |
||
100 | */ |
||
101 | public function saveBlock($key, $block) |
||
112 | } |
||
113 |