Symfony2 disable cache?(Symfony2 禁用缓存?)
问题描述
有没有办法禁用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 的默认模板引擎).在 Twig 中禁用缓存,这样您就不必像这样继续清除缓存:
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/*
导航到您的应用配置文件(默认情况下将位于根目录中的 ../app/config/config.yml).滚动到 twig 配置设置(在 twig: 下)并将缓存值(应该指向缓存目录)更改为 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 禁用缓存?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Symfony2 禁用缓存?
- 使用 GD 和 libjpeg 支持编译 PHP 2022-01-01
- 如何使用 Google API 在团队云端硬盘中创建文件夹? 2022-01-01
- PHP - if 语句中的倒序 2021-01-01
- 如何在 Symfony2 中正确使用 webSockets 2021-01-01
- 覆盖 Magento 社区模块控制器的问题 2022-01-01
- Oracle 即时客户端 DYLD_LIBRARY_PATH 错误 2022-01-01
- openssl_digest vs hash vs hash_hmac?盐与盐的区别HMAC? 2022-01-01
- 如何从数据库中获取数据以在 laravel 中查看页面? 2022-01-01
- Laravel 5:Model.php 中的 MassAssignmentException 2021-01-01
- PHP foreach() 与数组中的数组? 2022-01-01
