I am developing a website in symfony framework. In my cache folder a huge cache is stored. I want to disable cache permanently.
While I advise against disabling the cache on a production system, you can disable the twig templating engine cache, by editing and adding to your
twig: cache: false
The class cache in Symfony2 can be disabled in you
$loader = require_once __DIR__.'/../app/autoload.php'; Debug::enable(); $kernel = new AppKernel('dev', true); #$kernel->loadClassCache(); // <-- comment out this line $request = Request::createFromGlobals();
I think you can’t disable “permanently cache”, since Symfony applications use some cached files in order to run faster (or simply to run). Examples of this are the files that contains the dependency injection container (appProdProjectContainer.php).
You can disable some types of cache like Twig cache (as Diego Ferri said before) or Http Cache (unwrapping AppKernel with AppCache in app.php) or even Doctrine cache (in config.yml).
However I would not recommend this. The more you cache the app, the faster your app will be.
I was having caching issues even when using app_dev.php. I would change a route but it wouldn’t update when I tried accessing it via a browser.
I tried commenting out the anything that had cache in it (as stated above). My AppKernel(‘dev’, true) was set to true. Nothing worked.
If I ran the console cache:clear it would fix it, but the next routing change would break again. I had to run cache:clear with every save, which was ridiculous.
My issue turned out that because I was working remotely over SFTP, PHP Storm (my editor) was “preserving timestamp” in its deployment configuration. Once I changed that configuration the issues went away. Apparently there is some caching going on that is looking at the file timestamps, even in the dev environment.
When you are working in a dev environment state, the cache is disabled anyway – I’m assuming you only want to have it disabled within development, so use the /app_dev.php file to make sure nothing is cached.
Alternatively you can empty the cache periodically on the command line using
php app/console cache:clear
You can see all the different parameters here: http://symfony.com/doc/current/cookbook/console/usage.html