You are here

public function FileCache::__construct in Zircon Profile 8.0

Same name in this branch
  1. 8.0 core/lib/Drupal/Component/FileCache/FileCache.php \Drupal\Component\FileCache\FileCache::__construct()
  2. 8.0 vendor/doctrine/cache/lib/Doctrine/Common/Cache/FileCache.php \Doctrine\Common\Cache\FileCache::__construct()
Same name and namespace in other branches
  1. 8 vendor/doctrine/cache/lib/Doctrine/Common/Cache/FileCache.php \Doctrine\Common\Cache\FileCache::__construct()

Constructor.

Parameters

string $directory The cache directory.:

string $extension The cache file extension.:

Throws

\InvalidArgumentException

2 calls to FileCache::__construct()
FilesystemCache::__construct in vendor/doctrine/cache/lib/Doctrine/Common/Cache/FilesystemCache.php
Constructor.
PhpFileCache::__construct in vendor/doctrine/cache/lib/Doctrine/Common/Cache/PhpFileCache.php
Constructor.
2 methods override FileCache::__construct()
FilesystemCache::__construct in vendor/doctrine/cache/lib/Doctrine/Common/Cache/FilesystemCache.php
Constructor.
PhpFileCache::__construct in vendor/doctrine/cache/lib/Doctrine/Common/Cache/PhpFileCache.php
Constructor.

File

vendor/doctrine/cache/lib/Doctrine/Common/Cache/FileCache.php, line 70

Class

FileCache
Base file cache driver.

Namespace

Doctrine\Common\Cache

Code

public function __construct($directory, $extension = '', $umask = 02) {

  // YES, this needs to be *before* createPathIfNeeded()
  if (!is_int($umask)) {
    throw new \InvalidArgumentException(sprintf('The umask parameter is required to be integer, was: %s', gettype($umask)));
  }
  $this->umask = $umask;
  if (!$this
    ->createPathIfNeeded($directory)) {
    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));
  }

  // YES, this needs to be *after* createPathIfNeeded()
  $this->directory = realpath($directory);
  $this->extension = (string) $extension;
}