缓存文件模型cakePHP [英] cache file model cakePHP

查看:79
本文介绍了缓存文件模型cakePHP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在应用程序缓存模型中缓存模型文件

cache model files in app\tmp\cache\models\

我设置了配置

Cache::config('default', array(
            'engine' => 'File',
            'duration' => 3600000,
            'serialize' => false
        )
);

为什么模型似乎只在3s内缓存,如果> 3s,它将重新加载模型。 (因为如果我不缓存,我的应用程序会加载> 4s,如果我在< 3s中刷新页面,它只会加载1s,但是如果> 3s则它会加载> 4s。我认为加载缓慢是因为插件中的应用程序模型)

why model seem only cache in 3s , if > 3s it reloading model. ( because my app loading >4s if i dont cache , if I refresh page in <3s it loading only 1s, but if >3s it loading >4s. I assumes slow loading because app model in plugin )

为什么我设置持续时间3600000或'+ 5minutes'它仍会缓存<3s模型文件

WHY I SET duration 3600000 or '+5minutes' it still cache <3s model file

AND serialize => false仍会序列化(我已签入文件)

AND serialize => false it still serialize ( i checked in file )

通常会发生错误

C:\xampp\htdocs\myapp\app\tmp\cache\models\cake_model_default_poll_votes) [function.fopen]: failed to open stream: Invalid argument [CORE\cake\libs\file.php, line 154]

任何人的帮助我都非常感谢>< (我阅读了大量文档,请不要建议阅读文档...)

Anyone help I very appreciated >< ( i read documentation very many , please dont suggest read documentation...)

推荐答案

Cake会自动缓存模型架构,无论如何您在 Cache :: config 中设置绝对不会影响此行为。在调试模式下( Configure :: write('debug',> 0))Cake几乎不断刷新模型架构,以允许您在以下位置对数据库进行更改

Cake is automatically caching the model schema, whatever you set in Cache::config has absolutely no impact on this behavior. In debug mode (Configure::write('debug', > 0)) Cake is pretty much constantly refreshing the model schema to allow you to make changes to your database at any time and have these changes properly reflect in the application.

在生产模式下( Configure :: write('debug',0) code>)很少会刷新模型缓存。

In production mode (Configure::write('debug', 0)) the model cache will rarely be refreshed.

BTW,您应该阅读 core.php 文档:;-P

And BTW, you should read the core.php documentation: ;-P

/**
 * CakePHP Debug Level:
 *
 * Production Mode:
 *  0: No error messages, errors, or warnings shown. Flash messages redirect.
 *
 * Development Mode:
 *  1: Errors and warnings shown, model caches refreshed, flash messages halted.
 *  2: As in 1, but also with full debug messages and SQL output.
 *
 * In production mode, flash messages redirect after a time interval.
 * In development mode, you need to click the flash message to continue.
 */

这篇关于缓存文件模型cakePHP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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