如何完全禁用Cakephp中的缓存? [英] How do I completely disable caching in Cakephp?

查看:115
本文介绍了如何完全禁用Cakephp中的缓存?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我打开了缓存floodgates在我的Cakephp应用程序,现在我想关闭他们...

So I opened the cache floodgates in my Cakephp app and now I want to close them...

我做了几乎所有我可以:删除所有文件在tmp文件夹(但不是文件夹),在我的应用程序的core.php文件中打开Cache.disable,尝试清除缓存从一些控制器与clearCache()和缓存:: clear()()但我怀疑这不工作,因为它不加载控制器 - 由于缓存)。

I've done pretty much everything I can: delete all files in the tmp folder (but not the folders), turned 'Cache.disable' on in the core.php file in my app, have tried clearing the cache from within some controllers with clearCache() and Cache::clear() (but I suspect this doesn't work because it's not loading the controller -- due to caching).

我已经非常有效地停止了我的开发过程,因为缓存赢不关闭。任何人都有一些想法,我可以尝试?我开始认为它可能在浏览器或者我的主机服务,但它可能只是Cakephp打扰我。

I've pretty much effectively halted my development process just because caching won't turn off. Anyone have some ideas that I could try? I'm starting to think it may be within the browser or maybe my hosting service, but it's probably just Cakephp messing with me.

推荐答案

要排除浏览器缓存作为根本原因,您可以尝试添加以下行:

To rule out browser caching as the root cause, you might try adding the following lines:

        header('Cache-Control: no-store, private, no-cache, must-revalidate');                  // HTTP/1.1
        header('Cache-Control: pre-check=0, post-check=0, max-age=0, max-stale = 0', false);    // HTTP/1.1
        header('Pragma: public');
        header('Expires: Sat, 26 Jul 1997 05:00:00 GMT');                                       // Date in the past  
        header('Expires: 0', false); 
        header('Last-Modified: '.gmdate('D, d M Y H:i:s') . ' GMT');
        header('Pragma: no-cache');

根据我的经验,所有这些缓存清除HTTP头的组合在所有浏览器,并拥有了一些非常积极的缓存代理。

The combination of all these cache-busting HTTP headers has, in my experience, worked in all browsers, and has got around some very aggressive caching proxies as well.

这篇关于如何完全禁用Cakephp中的缓存?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆