2010-03-14 7 views
0

거기에 멋진 방법으로 zend_cache가 프런트 엔드 뷰를 처리하도록 만드는 방법이 있습니까? 로드 시간을 줄이고 페이지 캐싱을 수행하는 것이 가장 좋은 방법이라고 생각합니다.똑똑한 페이지 캐싱과 유사한 Zend 페이지 캐싱?

{nocache}와 비슷한 것이 필요합니다. 좋아

그래서 지금이 :

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; 
} 

Bootstrap.php

하지만, 내 캐시가 명중 유일한 시간 같은 코드입니다 :

$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); 
      } 

내가 전체보기를 캡처 기대했다.

누구나 완벽하게 구현하는 방법에 대한 실무 사례가 있습니까? 문서는 실제로 깊이 들어가지 않습니다.

답변

1

Zend_Cache_Frontend_Output 또는 Zend_Cache_Frontend_Page을 사용할 수 있습니다. 젠드 프레임 워크에서 manual :

Zend_Cache_Frontend_Output은 출력 캡쳐 프론트 엔드입니다. PHP에서 출력 버퍼링을 사용하여 start()와 end() 메소드 사이의 모든 것을 캡처합니다.

Zend_Cache_Frontend_Page은 Zend_Cache_Frontend_Output과 비슷하지만 전체 페이지로 제작되었습니다.

0

아마도 Zend_Cache_Frontend_Page을 찾고있을 것입니다. 자세한 내용은 Zend Cache docs을 참조하십시오.