0
我寫了函數來緩存我網站中的每個頁面,並將這個函數放在Bootstrap文件中。Zend Cache不從緩存中讀取
緩存文件是在每個請求上創建的,即使是同一頁也是如此。
我錯過了什麼嗎?
即使我從配置中刪除正則表達式數組,它也不起作用。
的Zend 1.12.3
protected function _initCache() {
$cachePath = APPLICATION_PATH
. DIRECTORY_SEPARATOR
. '..'
. DIRECTORY_SEPARATOR
. '_cache';
$fO = array(
'lifetime' => 7200,
'automatic_serialization' => true,
'regexps' => array(
'^/admin/' => array(
'cache' => false
),
'^/account/' => array(
'cache' => false
),
'^/cart/' => array(
'cache' => false
),
),
'content_type_memorization' => true,
'default_options' => array(
'cache' => true,
'cache_with_get_variables' => true,
'cache_with_post_variables' => true,
'cache_with_session_variables' => true,
'cache_with_cookie_variables' => true,
),
);
$bO = array(
'cache_dir' => $cachePath
);
$cache = Zend_Cache::factory('Page', 'File', $fO, $bO);
$cache->start();
}
我認爲這不是一個問題在這裏。 Zend_Cache爲start()自動生成id,爲什麼Zend_Cache爲同樣的內容生成另一個id(和緩存文件)? – sanneo
如果未指定start()方法的參數,則zend會從 'Get','Post','Session','Files'和'Cookie'創建ID。你確定每次都是一樣的嗎? –