CakePHP 缓存
我试图为我的网站(仍在本地计算机上)启用缓存,以便在上线时进行更快的调用(在某个页面中,我有 111 个 SELECT sql 查询),但我有点卡住了。
我转到 app/config/core.php 并启用 Configure::write('Cache.check', true);
行,然后转到我的控制器并添加以下行:
var $helpers = array('缓存');
var $cacheAction = "1 hour";
当我访问控制器时,我没有在 app/tmp/cache 下创建任何文件夹,并且在视图中我添加了 sql_dump 元素,该元素仍在输出 111一直在查询。
知道我做错了什么吗? 谢谢
I'm trying to enable caching for my site (still on a local machine) to have faster calls when going live (in a certain page, I have 111 SELECT sql queries) and I'm stuck a bit.
I went to app/config/core.php and enabled the Configure::write('Cache.check', true);
line and went to my controller and added the following lines:
var $helpers = array('Cache');
var $cacheAction = "1 hour";
When I access my controller, I don't have any folders created under the app/tmp/cache and in the View I have added the sql_dump element which is still outputting the 111 queries all the time.
Any idea what I'm doing wrong please?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
从技术上讲,您已经完成了启用视图缓存的所有步骤,因此我怀疑这与无法写入缓存文件夹有关。
确保您的错误报告设置至少为 error_reporting(E_ALL);查看 PHP 是否抱怨权限问题。
此外,检查是否正确 chmod 了 tmp 目录(和子目录)。我一时记不起正确的权限(我认为是 775),但 777 肯定可以工作(但不那么安全)。
You have technically completed all the steps to enable view caching, so I would suspect it has something to do with being unable to write to the cache folder.
Make sure you have your error reporting set to at minimum error_reporting(E_ALL); to see if PHP complains about a permission issue.
Furthermore, check to see if you have chmod'd the tmp dir (and subdir's) correctly. I can't remember off the top of my head the correct permission (I think 775), but 777 will definitely work (but not as secure).