2016-11-25 114 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 

希望這有助於

相關問題