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

时间:2016-11-25 19:00:42

标签: php caching symfony

我正在Windows上寻找FileSystemAdapter生成的缓存的位置。我认为它将在应用程序目录的var / cache中,但它看起来并不像我清除它时,它仍在使用缓存。

知道它可能在哪里吗?

2 个答案:

答案 0 :(得分:3)

检查类的source code,类使用this trait,如果没有指定目录,它将使用函数sys_get_temp_dir返回用于临时的目录路径文件。

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

C:\Windows\Temp

希望这个帮助

答案 1 :(得分:3)

<强> Filesystem Cache Adapter

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
);
  

note :如果未指定,则在系统内创建目录   临时目录。

另见:Removing Cache Items

相关问题