2016-11-25 110 views
2

我在Windows上查找由FileSystemAdapter生成的缓存位置。我认为它应该在应用程序目录的var/cache中,但它看起来不像我清除它时那样,它仍然使用缓存。Symfony 3中FilesystemAdapter的默认缓存目录在哪里?

任何想法它可能是?

+1

如果没有定义系统临时目录中创建一个目录的位置。 –

回答

2

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

:如果没有指定,目录是在sys内部创建的temp 临时目录。

另见:Removing Cache Items

+0

谢谢,在我的Cygwin shell中,目录位于/ tmp/symfony-cache / –

2

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

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

C:\Windows\Temp 

希望这有助于