You are here

public function FileCache::__construct in Plug 7

Same name in this branch
  1. 7 lib/Drupal/Component/FileCache/FileCache.php \Drupal\Component\FileCache\FileCache::__construct()
  2. 7 lib/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 lib/doctrine/cache/lib/Doctrine/Common/Cache/FilesystemCache.php
Constructor.
PhpFileCache::__construct in lib/doctrine/cache/lib/Doctrine/Common/Cache/PhpFileCache.php
Constructor.
2 methods override FileCache::__construct()
FilesystemCache::__construct in lib/doctrine/cache/lib/Doctrine/Common/Cache/FilesystemCache.php
Constructor.
PhpFileCache::__construct in lib/doctrine/cache/lib/Doctrine/Common/Cache/PhpFileCache.php
Constructor.

File

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

Class

FileCache
Base file cache driver.

Namespace

Doctrine\Common\Cache

Code

public function __construct($directory, $extension = '') {
  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 = (string) $extension;
}