Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Symfony2 disable cache?

Is there a way to disable the caching function in Symfony2? I tried to find the setting in the config* and parameters.ini files and I searched a lot. Ok, I found a few solutions, but nothing for the latest version (Symfony2).

WHY? Because I want to test new templates and functions without clearing the app/cache* all the time.

like image 387
NaN Avatar asked Aug 25 '11 14:08

NaN


People also ask

How to delete cache in symfony?

Clearing the Cache 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".

How do I disable cache in laravel 8?

To disable the cache you have to add the following to your config/cache. php file. 'stores' => [ //... 'none' => [ 'driver' => 'null', ], ], Now you have to change your CACHE_DRIVER value to none in your .

How do I clear my doctrine cache?

From the Doctrine command line you can run the following commands: To clear the query cache use the orm:clear-cache:query task. To clear the metadata cache use the orm:clear-cache:metadata task. To clear the result cache use the orm:clear-cache:result task.


Video Answer


1 Answers

I'm assuming you're using the Twig engine, (the default templating engine for Symfony2). To disable caching in twig, so that you do not have to keep clearing the cache like so:

rm -rf app/cache/* 

Navigate to your app config file (by defualt will be located in ../app/config/config.yml from your root directory). Scroll to the twig configuration settings (under twig:) and change the cache value (which should be pointing to the cache directory) to false like so:

twig:     cache:  false 

If you do not see any cache configuration entry, simply add the line above.

It may also be helpful to checkout the configuring reference for the Twig bundle: http://symfony.com/doc/2.0/reference/configuration/twig.html

After editing your config_dev.yml file, go to your terminal and run:

app/console cache:clear 
like image 139
Prince Mabandla Avatar answered Sep 29 '22 15:09

Prince Mabandla