| 1 | <?php |
||
| 24 | class CacheFactory |
||
| 25 | { |
||
| 26 | /** |
||
| 27 | * @var AdapterFactory |
||
| 28 | */ |
||
| 29 | protected AdapterFactory $adapterFactory; |
||
|
|
|||
| 30 | |||
| 31 | /** |
||
| 32 | * CacheFactory constructor. |
||
| 33 | * |
||
| 34 | * @param AdapterFactory $factory |
||
| 35 | */ |
||
| 36 | 1 | public function __construct(AdapterFactory $factory) |
|
| 37 | { |
||
| 38 | 1 | $this->adapterFactory = $factory; |
|
| 39 | 1 | } |
|
| 40 | |||
| 41 | /** |
||
| 42 | * Constructs a new Cache instance. |
||
| 43 | * |
||
| 44 | * @param string $name |
||
| 45 | * @param array $options |
||
| 46 | * |
||
| 47 | * @return Cache |
||
| 48 | * @throws FactoryException |
||
| 49 | */ |
||
| 50 | 1 | public function newInstance(string $name, array $options = []): Cache |
|
| 51 | { |
||
| 52 | 1 | $adapter = $this->adapterFactory->newInstance($name, $options); |
|
| 53 | |||
| 54 | 1 | return new Cache($adapter); |
|
| 55 | } |
||
| 56 | } |
||
| 57 |