1 | <?php |
||
22 | class CachingLoader extends LoaderDecorator |
||
23 | { |
||
24 | |||
25 | /** |
||
26 | * @var CollectionInterface $cache |
||
27 | */ |
||
28 | protected $cache; |
||
29 | |||
30 | /** |
||
31 | * @var string $identifier |
||
32 | */ |
||
33 | protected $identifier; |
||
34 | |||
35 | |||
36 | |||
37 | /** |
||
38 | * CachingLoader constructor. |
||
39 | * |
||
40 | * @param LoaderDecoratorInterface $loader |
||
41 | * @param CollectionInterface $cache |
||
42 | * @param string $identifier |
||
43 | * @throws InvalidDataTypeException |
||
44 | */ |
||
45 | public function __construct(LoaderDecoratorInterface $loader, CollectionInterface $cache, $identifier = '') |
||
66 | |||
67 | |||
68 | |||
69 | /** |
||
70 | * @return string |
||
71 | */ |
||
72 | public function identifier() |
||
76 | |||
77 | |||
78 | |||
79 | /** |
||
80 | * @param string $identifier |
||
81 | * @throws InvalidDataTypeException |
||
82 | */ |
||
83 | private function setIdentifier($identifier) |
||
90 | |||
91 | |||
92 | |||
93 | /** |
||
94 | * @param string $fqcn |
||
95 | * @param array $arguments |
||
96 | * @return mixed |
||
97 | * @throws InvalidEntityException |
||
98 | * @throws ServiceNotFoundException |
||
99 | */ |
||
100 | public function load($fqcn, $arguments = array()) |
||
124 | |||
125 | |||
126 | |||
127 | /** |
||
128 | * empties cache and calls reset() on loader if method exists |
||
129 | */ |
||
130 | public function reset() |
||
135 | |||
136 | |||
137 | } |
||
138 | // End of file CachingLoader.php |
||
140 |