Symfony2 禁用缓存?

Symfony2 disable cache?(Symfony2 禁用缓存?)
本文介绍了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 禁用缓存?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

相关文档推荐

DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)