2011-12-29 1 views
0

私はZend FrameworkでWebサイトを開発しています。私はZFDebugを使いたいと思います。
hereと記載されているインストール手順に従っていますが、ブートストラップでZend_Cacheを初期化しません(設定ファイルのセクションのキャッシュマネージャ設定を定義しています)。
だから、ZFDebugのための私のブートストラップセクションでは、このようになります。このコードZFDebugでZFDebugのキャッシュプラグインを有効にする

if ($this->hasPluginResource("cachemanager")) { 
    $this->bootstrap("cachemanager"); 
    $cache = $this->getPluginResource("cachemanager")->getCacheManager()->getCache("default"); 
    $options["plugins"]["Cache"] = array("backend" => $cache->getBackend()); 
} 
$debug = new ZFDebug_Controller_Plugin_Debug($options); 

は、メニューの[キャッシュ]の項目を示しているが、それはクリックできません。 ZFDebugにキャッシュ情報を表示させるにはどうすればよいですか?私はZend_CacheバックエンドとしてXcacheを使用します。

答えて

0

私は今朝ZFDebugで遊んで始めましたが、私のBoostrap.php initはキャッシュを最初に登録しています。 _initZFDebugでは、レジストリを呼び出してキャッシュを取得します。

protected function _initCache() 
{ 
    $frontendOptions = array(
     'lifetime' => 3600*24*5, // cache lifetime of 5 days 
     'automatic_serialization' => true, 
     'logging' => false, 
     'caching' => true 
    ); 

    $backendOptions = array(
     'cache_dir' => './../data/cache/', // Directory where to put the cache files 
     'hashed_directory_level' => 2 
    ); 

    $flickrFrontendOptions = array(
     'lifetime' => 3600*24*5, // cache lifetime of 5 days 
     'automatic_serialization' => true, 
     'logging' => false, 
     'caching' => true 
    ); 

    $flickrBackendOptions = array(
     'cache_dir' => './../data/flickr/', // Directory where to put the cache files 
     'hashed_directory_level' => 2 
    ); 

    // getting a Zend_Cache_Core object 
    $cache = Zend_Cache::factory(
     'Core', 
     'File', 
     $frontendOptions, 
     $backendOptions); 
    Zend_Registry::set('cache', $cache); 

    $flickrcache = Zend_Cache::factory(
     'Core', 
     'File', 
     $flickrFrontendOptions, 
     $flickrBackendOptions); 
    Zend_Registry::set('flickrcache', $flickrcache); 
} 

protected function _initZFDebug() 
{ 
    if ($this->hasOption('zfdebug')) 
    { 
     $autoloader = Zend_Loader_Autoloader::getInstance(); 
     $autoloader->registerNamespace('ZFDebug'); 

     $options = array(
      'plugins' => array('Variables', 
           'Database' => array('adapter' => $db), 
           'File' => array('basePath' => $this->hasOption('zfdebug.basePath')), 
           'Cache' => array('backend' => Zend_Registry::get('cache')->getBackend()), 
           'Exception') 
     ); 
     $debug = new ZFDebug_Controller_Plugin_Debug($options); 

     $this->bootstrap('frontController'); 
     $frontController = $this->getResource('frontController'); 
     $frontController->registerPlugin($debug); 
    } 
} 
関連する問題