public function clearDataDirectory($cacheOnly = false)
    {
        $dir = __DIR__ . $this->dataDir;
        if (is_dir($dir)) {
            if ($dirHandle = opendir($dir)) {
                while (($file = readdir($dirHandle)) !== false) {
                    if (filetype($dir . $file) === 'file'
                        && (false === $cacheOnly || $this->startsWith($file, $this->cachedPrefix))) {
                        unlink($dir . $file);
                    }
                }
                closedir($dirHandle);
            }
        }
    }