public function __construct($directory, $fileExtension = self::DEFAULT_EXTENSION, $namespace = null)
{
parent::__construct($namespace);
$this->rootDirectory = $directory . DIRECTORY_SEPARATOR;
$this->fileExtension = $fileExtension;
if ($namespace !== null) {
$this->directory = $this->rootDirectory . md5($namespace) . DIRECTORY_SEPARATOR;
} else {
$this->directory = $this->rootDirectory;
}
if (!is_dir($this->directory)) {
if (!@mkdir($this->directory, 0777, true)) {
throw new PinqException('Invalid cache directory: %s does not exist and could not be created', $this->directory);
}
}
}