1 | <?php |
||
27 | class Cache |
||
28 | { |
||
29 | /** |
||
30 | * @var self |
||
31 | */ |
||
32 | protected static $selfInstance; |
||
33 | |||
34 | /** |
||
35 | * @var array |
||
36 | */ |
||
37 | protected $config = []; |
||
38 | |||
39 | /** |
||
40 | * @var Stopwatch |
||
41 | */ |
||
42 | protected $stopwatch; |
||
43 | |||
44 | /** |
||
45 | * Contains all cache instances |
||
46 | * |
||
47 | * @var \phpFastCache\Core\Pool\ExtendedCacheItemPoolInterface[] |
||
48 | */ |
||
49 | protected $cacheInstances = []; |
||
50 | |||
51 | /** |
||
52 | * Cache constructor. |
||
53 | * |
||
54 | * @param array $config |
||
55 | * @param Stopwatch $stopwatch |
||
56 | * |
||
57 | * @throws \phpFastCache\Exceptions\phpFastCacheDriverException |
||
58 | */ |
||
59 | protected function __construct($config, Stopwatch $stopwatch = null) |
||
64 | |||
65 | /** |
||
66 | * Factory instance provider |
||
67 | * |
||
68 | * @param array $config |
||
69 | * @param Stopwatch $stopwatch |
||
70 | * |
||
71 | * @throws \phpFastCache\Exceptions\phpFastCacheDriverException |
||
72 | * @return self |
||
73 | */ |
||
74 | public static function getInstance($config, Stopwatch $stopwatch = null) |
||
78 | |||
79 | /** |
||
80 | * Set a new cache instance |
||
81 | * |
||
82 | * @param string $name |
||
83 | * @param ExtendedCacheItemPoolInterface $instance |
||
84 | * |
||
85 | * @throws \phpFastCache\Exceptions\phpFastCacheDriverException |
||
86 | */ |
||
87 | public function createInstance($name, $instance) |
||
94 | |||
95 | /** |
||
96 | * get a cache instance |
||
97 | * |
||
98 | * @param string $name Name of configured driver |
||
99 | * |
||
100 | * @return \phpFastCache\Core\Pool\ExtendedCacheItemPoolInterface |
||
101 | * |
||
102 | * @throws \phpFastCache\Exceptions\phpFastCacheDriverException |
||
103 | */ |
||
104 | public function get($name) |
||
126 | |||
127 | /** |
||
128 | * @return \phpFastCache\Core\Pool\ExtendedCacheItemPoolInterface |
||
129 | */ |
||
130 | public function getTwigCacheInstance() |
||
134 | |||
135 | /** |
||
136 | * Return all cache instances |
||
137 | * |
||
138 | * @return array |
||
139 | */ |
||
140 | public function getConfig() |
||
144 | |||
145 | /** |
||
146 | * Return all cache instances |
||
147 | * |
||
148 | * @return \phpFastCache\Core\Pool\ExtendedCacheItemPoolInterface[] |
||
149 | */ |
||
150 | public function getInstances() |
||
154 | } |