public function getCachePath() {
        $cachePath= false;
        if (!isset ($this->xpdo->config['cache_path'])) {
            while (true) {
                if (!empty ($_ENV['TMP'])) {
                    if ($cachePath= strtr($_ENV['TMP'], '\\', '/'))
                        break;
                }
                if (!empty ($_ENV['TMPDIR'])) {
                    if ($cachePath= strtr($_ENV['TMPDIR'], '\\', '/'))
                        break;
                }
                if (!empty ($_ENV['TEMP'])) {
                    if ($cachePath= strtr($_ENV['TEMP'], '\\', '/'))
                        break;
                }
                if ($temp_file= @ tempnam(md5(uniqid(rand(), true)), '')) {
                    $cachePath= strtr(dirname($temp_file), '\\', '/');
                    @ unlink($temp_file);
                }
                break;
            }
            if ($cachePath) {
                if ($cachePath{strlen($cachePath) - 1} != '/') $cachePath .= '/';
                $cachePath .= '.xpdo-cache';
            }
        }
        else {
            $cachePath= strtr($this->xpdo->config['cache_path'], '\\', '/');
        }
        if ($cachePath) {
            $perms = $this->getOption('new_folder_permissions', null, $this->getFolderPermissions());
            if (is_string($perms)) $perms = octdec($perms);
            if (@ $this->writeTree($cachePath, $perms)) {
                if ($cachePath{strlen($cachePath) - 1} != '/') $cachePath .= '/';
                if (!is_writeable($cachePath)) {
                    @ chmod($cachePath, $perms);
                }
            } else {
                $cachePath= false;
            }
        }
        return $cachePath;
    }