Beispiel #1
0
 private static function initConfig()
 {
     if (self::$_no_of_instance == null) {
         $config = Zend_Registry::get('configuration');
         if (isset($config->cachingfarm)) {
             if (isset($config->default_cache)) {
                 self::$_default_instance = $config->default_cache;
             }
             $list = $config->cachingfarm->list;
             $arr = explode(',', $list);
             if (count($arr) > 0) {
                 self::$_no_of_instance = count($arr);
                 for ($i = 0; $i < self::$_no_of_instance; $i++) {
                     $cache = $arr[$i];
                     if (isset($config->cachingfarm->{$cache})) {
                         $con = $config->cachingfarm->{$cache};
                         $_enable = $con->enable;
                         $_server = $con->host;
                         $_port = $con->port;
                         $debug = Globals::isDebug();
                         if (empty($debug)) {
                             $debug = false;
                         }
                         if ($_enable) {
                             //echo "i'm here with $cache - $_enable - $_server - $_port <br>";
                             $memcache = new Zing_Cache_ZingCache($_server, $_port, $debug);
                             self::$_cache_array[$cache] = $memcache;
                         }
                     }
                 }
             }
         }
     }
 }
Beispiel #2
0
 public function dispatchLoopShutdown()
 {
     if (Globals::isDebug()) {
         $print = "";
         self::$_time_end_render = gettimeofday(true);
         $print = $this->dumpPageRenderProfiler(self::$_time_start_render, self::$_time_end_render);
         $print .= $this->dumpCacheProfiler();
         $print .= '<br><br>' . ProfilerLog::dumpLog();
         $print .= $this->dumpDbProfiler();
         $this->getResponse()->appendBody($print);
     }
 }
Beispiel #3
0
 public function pushToCacheProfiler($key, $result, $starttime, $endtime)
 {
     $debug = Globals::isDebug();
     if ($debug == true) {
         $_cache_result = new ResultCache();
         $_cache_result->key = $key;
         $diff = $endtime - $starttime;
         $this->_total_time += $diff;
         $_cache_result->ellapsedtime = $diff;
         if ($result == null) {
             $this->_total_misses++;
             $_cache_result->result = 0;
             $this->_key_profiler_misses[] = $_cache_result;
         } else {
             $this->_total_hits++;
             $_cache_result->result = 1;
             $this->_key_profiler_hits[] = $_cache_result;
         }
     }
 }