| 1 | <?php |
||
| 9 | final class ModelCache implements ModelCacheInterface |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | * @var ModelInterface[]|array |
||
| 13 | */ |
||
| 14 | private $cache = []; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * @param ModelInterface $model |
||
| 18 | * |
||
| 19 | * @return ModelCacheInterface |
||
| 20 | */ |
||
| 21 | public function set(ModelInterface $model): ModelCacheInterface |
||
| 27 | |||
| 28 | /** |
||
| 29 | * @param string $id |
||
| 30 | * |
||
| 31 | * @return bool |
||
| 32 | */ |
||
| 33 | public function has(string $id): bool |
||
| 37 | |||
| 38 | /** |
||
| 39 | * @param string $id |
||
| 40 | * |
||
| 41 | * @return ModelInterface |
||
| 42 | * |
||
| 43 | * @throws ModelNotFoundException |
||
| 44 | */ |
||
| 45 | public function get(string $id) |
||
| 53 | |||
| 54 | /** |
||
| 55 | * @param string $id |
||
| 56 | * |
||
| 57 | * @return ModelCacheInterface |
||
| 58 | */ |
||
| 59 | public function remove(string $id): ModelCacheInterface |
||
| 65 | } |
||
| 66 |