public function __construct($cache_dir) { $this->cache_dir = $cache_dir; if (!is_dir($cache_dir)) { $make_dir_result = mkdir($cache_dir, 0755, true); if ($make_dir_result === false) { throw new \Exception('Cannot create the cache directory'); } } }