Symfony2禁用缓存? [英] Symfony2 disable cache?
问题描述
有没有办法禁用Symfony2中的缓存功能?我试图在config *和parameters.ini文件中找到该设置,然后进行了很多搜索.好的,我找到了一些解决方案,但最新版本(Symfony2)却没有.
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.
推荐答案
我假设您正在使用Twig引擎(Symfony2的默认模板引擎).要禁用树枝中的缓存,这样您就不必像这样一直清除缓存:
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/*
导航到您的应用配置文件(通过defualt将位于您根目录的 ../app/config/config.yml 中).滚动到细枝配置设置(在细枝:下),然后将缓存值(应指向缓存目录)更改为 false ,如下所示:
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
如果看不到任何缓存配置条目,只需在上面添加行即可.
检出Twig捆绑包的配置参考也可能会有所帮助: http ://symfony.com/doc/2.0/reference/configuration/twig.html
It may also be helpful to checkout the configuring reference for the Twig bundle: http://symfony.com/doc/2.0/reference/configuration/twig.html
编辑config_dev.yml文件后,转到终端并运行:
After editing your config_dev.yml file, go to your terminal and run:
app/console cache:clear
这篇关于Symfony2禁用缓存?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!