1 | <?php |
||
29 | class Phpfastcache |
||
30 | { |
||
31 | /** |
||
32 | * @var array |
||
33 | */ |
||
34 | private $config = []; |
||
35 | |||
36 | /** |
||
37 | * @var Stopwatch |
||
38 | */ |
||
39 | protected $stopwatch; |
||
40 | |||
41 | /** |
||
42 | * Contains all cache instances |
||
43 | * |
||
44 | * @var \Phpfastcache\Core\Pool\ExtendedCacheItemPoolInterface[] |
||
45 | */ |
||
46 | private $cacheInstances = []; |
||
47 | |||
48 | /** |
||
49 | * Cache constructor. |
||
50 | * |
||
51 | * @param array $config |
||
52 | * @param Stopwatch $stopwatch |
||
53 | * |
||
54 | * @throws \Phpfastcache\Exceptions\phpFastCacheDriverException |
||
55 | */ |
||
56 | public function __construct(array $config, Stopwatch $stopwatch = null) |
||
61 | |||
62 | /** |
||
63 | * Set a new cache instance |
||
64 | * |
||
65 | * @param string $name |
||
66 | * @param ExtendedCacheItemPoolInterface $instance |
||
67 | * |
||
68 | * @throws \Phpfastcache\Exceptions\phpFastCacheDriverException |
||
69 | */ |
||
70 | public function createInstance(string $name, ExtendedCacheItemPoolInterface $instance) |
||
77 | |||
78 | /** |
||
79 | * get a cache instance |
||
80 | * |
||
81 | * @param string $name Name of configured driver |
||
82 | * |
||
83 | * @return ExtendedCacheItemPoolInterface |
||
84 | * |
||
85 | * @throws \Phpfastcache\Exceptions\phpFastCacheDriverException |
||
86 | * @throws \Phpfastcache\Exceptions\PhpfastcacheInvalidConfigurationException |
||
87 | */ |
||
88 | public function get(string $name): ExtendedCacheItemPoolInterface |
||
125 | |||
126 | /** |
||
127 | * @return \Phpfastcache\Core\Pool\ExtendedCacheItemPoolInterface |
||
128 | */ |
||
129 | public function getTwigCacheInstance(): ExtendedCacheItemPoolInterface |
||
133 | |||
134 | /** |
||
135 | * Return all cache instances |
||
136 | * |
||
137 | * @return array |
||
138 | */ |
||
139 | public function getConfig(): array |
||
143 | |||
144 | /** |
||
145 | * Return all cache instances |
||
146 | * |
||
147 | * @return \Phpfastcache\Core\Pool\ExtendedCacheItemPoolInterface[] |
||
148 | */ |
||
149 | public function getInstances(): array |
||
153 | } |