Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where is default cache directory for FilesystemAdapter in Symfony 3?

I'm on Windows and looking for the location of the cache generated by FileSystemAdapter. I thought it would be in var/cache of the application directory but it doesn't look like as when I clear it, it's still using the cache.

Any idea where it could be?

like image 460
laurent Avatar asked Nov 25 '16 19:11

laurent


People also ask

How to clear cache in Symfony 3. 4?

Clearing the Cache To clear the cache you can use the bin/console cache:pool:clear [pool] command.

How to cache clear in Symfony?

To clear the cache you can use the bin/console cache:pool:clear [pool] command. That will remove all the entries from your storage and you will have to recalculate all the values. You can also group your pools into "cache clearers".

What is a cache component?

The Cache component provides features covering simple to advanced caching needs. It natively implements PSR-6 and the Cache Contracts for greatest interoperability. It is designed for performance and resiliency, ships with ready to use adapters for the most common caching backends.


2 Answers

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: if none is specified, a directory is created inside the system temporary directory.

Also see: Removing Cache Items

like image 95
l'L'l Avatar answered Sep 21 '22 06:09

l'L'l


Checking in the source code of the class, the class use this trait and if you don't specify a directory, it will use the function sys_get_temp_dir that return directory path used for temporary files.

For a Windows-based system could be:

C:\Windows\Temp

Hope this help

like image 37
Matteo Avatar answered Sep 23 '22 06:09

Matteo