public function __construct($modelName, Cache $cache) { $this->modelName = $modelName; $this->cache = $cache; $data = $this->cache->get($this->modelName); if ($data !== null) { $this->prepared = true; $this->model = $data; } }