Symfony 3 中 FilesystemAdapter 的默认缓存目录在哪里?

lau*_*ent 5 php caching symfony

我在 Windows 上,正在寻找由FileSystemAdapter. 我以为它会在应用程序目录的 var/cache 中,但它看起来不像我清除它时,它仍在使用缓存。

知道它可能在哪里吗?

Mat*_*teo 5

检查类的源代码,该类使用此特征,如果不指定目录,它将使用函数sys_get_temp_dir返回用于临时文件的目录路径。

对于基于 Windows 的系统可能是:

C:\Windows\Temp
Run Code Online (Sandbox Code Playgroud)

希望这有帮助


l'L*_*L'l 5

文件系统缓存适配器

use Symfony\Component\Cache\Adapter\FilesystemAdapter;

$cache = new FilesystemAdapter(
    // the subdirectory of the main cache directory where cache items are stored
    $namespace = '',
    // in seconds; applied to cache items that don't define their own lifetime
    // 0 means to store the cache items indefinitely (i.e. until the files are deleted)
    $defaultLifetime = 0,
    // the main cache directory (the application needs read-write permissions on it)
    // if none is specified, a directory is created inside the system temporary directory
    $directory = null
);
Run Code Online (Sandbox Code Playgroud)

注意:如果没有指定,则会在系统临时目录中创建一个目录。

另请参阅:删除缓存项