Zend framework Zend页面缓存与smarty类似?
我有没有办法让zend_缓存处理前端视图类似于smarty?我想减少加载时间,页面缓存似乎是最好的方法 它还需要类似于{nocache}的东西 好的,我现在有:Bootstrap.phpZend framework Zend页面缓存与smarty类似?,zend-framework,smarty,zend-cache,Zend Framework,Smarty,Zend Cache,我有没有办法让zend_缓存处理前端视图类似于smarty?我想减少加载时间,页面缓存似乎是最好的方法 它还需要类似于{nocache}的东西 好的,我现在有:Bootstrap.php protected function _initCache() { $this->bootstrap('locale'); $locale = $this->getResource('locale'); $front = array ( 'lifetime' =&
protected function _initCache() {
$this->bootstrap('locale');
$locale = $this->getResource('locale');
$front = array ( 'lifetime' => 1800,
'automatic_serialization' => false,
'caching' => true,
'cache_id_prefix' => 'ec_',
'debug_header' => true,
'default_options'
=> array ('cache_with_get_variables' => true,
'cache_with_post_variables' => false,
'cache_with_session_variables' => false,
'cache_with_cookie_variables' => false ),
);
$back = array('cache_dir' => '../data/Cache/'.$locale);
$cache = Zend_Cache::factory('Page', 'File', $front, $back);
$cache->start();
Zend_Registry::set('cache', $cache);
return $cache;
}
但是,我的缓存被命中的唯一时间是使用以下代码:
$cache = Zend_Registry::get('cache');
if (!$data = $cache->load('sidebar_'.$module.'_'.$controller)) {
$data['Studio'] = Eurocreme_Studio::load_by_type(array('type' => 'sidebar', 'from' => 0, 'to' => COUNT_HIGH));
$data['Movie'] = Eurocreme_Movie::load_by_type(array('type' => 'sidebar', 'from' => 0, 'to' => 5));
$data['Gallery'] = Eurocreme_Gallery::load_by_type(array('type' => 'sidebar', 'from' => 0, 'to' => 5));
$data['Category'] = Eurocreme_Category::load_tree(0);
$cache->save($data, 'my_view_helper_sidebar_'.$module.'_'.$controller);
}
我希望能捕捉到整个画面
有没有人有任何关于如何全面实施的工作实例?文档并不深入。您可能需要使用
Zend\u Cache\u Frontend\u输出
或Zend\u Cache\u Frontend\u页面
。来自Zend框架:
Zend_缓存_前端_输出
是捕获前端的输出。它利用PHP中的输出缓冲来捕获start()和end()方法之间的所有内容
Zend\u Cache\u Frontend\u页面
类似于Zend\u Cache\u Frontend\u输出,但设计为完整页面。您可能正在寻找Zend\u Cache\u Frontend\u页面
。详情请参阅