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