public function FileCache::__construct

Constructor

Parameters

string $directory Cache directory.:

string $directory Cache file extension.:

Throws

\InvalidArgumentException

File

drupal/core/vendor/doctrine/common/lib/Doctrine/Common/Cache/FileCache.php, line 49

Class

FileCache
Base file cache driver.

Namespace

Doctrine\Common\Cache

Code

public function __construct($directory, $extension = null) {
  if (!is_dir($directory) && !@mkdir($directory, 0777, true)) {
    throw new \InvalidArgumentException(sprintf('The directory "%s" does not exist and could not be created.', $directory));
  }
  if (!is_writable($directory)) {
    throw new \InvalidArgumentException(sprintf('The directory "%s" is not writable.', $directory));
  }
  $this->directory = realpath($directory);
  $this->extension = $extension ?: $this->extension;
}