CakePHP 3 - 奇怪的缓存问题

时间:2015-06-01 19:30:58

标签: php cakephp caching cakephp-3.0

我正在开发一个最初以cakephp 3.0公开测试版开始的项目,并且已经更新到当前的稳定版本。出于某种原因,每个请求都被缓存约2分钟,甚至是那些专门禁用缓存的请求。这使得开发绝对不可能,因为尽管代码发生了变化,调试代码(var_dump等)仍然存在。

在MAMP3上本地运行(PHP 5.6)

App.php

'Cache' => [
    'default' => [
        'className' => 'File',
        'path' => CACHE
    ],

    'weather' => [
        'className' => 'File',
        'duration' => '+6 hours',
        'path' => CACHE,
    ],

/**
 * Configure the cache used for general framework caching.  Path information,
 * object listings, and translation cache files are stored with this configuration.
 */
    '_cake_core_' => [
        'className' => 'File',
        'prefix' => '_cake_core_',
        'path' => CACHE . 'persistent/',
        'serialize' => true,
        'duration' => '+2 seconds',
    ],

/**
 * Configure the cache for model and datasource caches.  This cache configuration
 * is used to store schema descriptions, and table listings in connections.
 */
    '_cake_model_' => [
        'className' => 'File',
        'prefix' => '_cake_model_',
        'path' => CACHE . 'models/',
        'serialize' => true,
        'duration' => '+2 seconds',
    ],
],

env.php(即DOTENV)

use Cake\Core\Configure;
use Cake\Cache\Cache;

Configure::write('debug', true);
Cache::disable();

BaseController.php(超类)

public function beforeFilter(Event $event){
    parent::beforeFilter($event);
    $this->response->disableCache();
    Cache::disable();
}

Cache::Enabled()按预期输出false

HTTP响应具有以下标头:

Cache-Control:no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Connection:Keep-Alive
Content-Type:application/json; charset=UTF-8
Date:Mon, 01 Jun 2015 19:18:39 GMT
Expires:Mon, 26 Jul 1997 05:00:00 GMT
Keep-Alive:timeout=5, max=100
Last-Modified:Mon, 01 Jun 2015 19:18:39 GMT
Pragma:no-cache
Server:Apache
Transfer-Encoding:chunked

我的tmp / cache / * /目录总是空的。

尽管所有这些更改都需要两分钟才能在浏览器中反映出来。

对此的任何帮助将不胜感激。

0 个答案:

没有答案