Пример #1
0
 private function _getStatistics()
 {
     $endTime = microtime(true);
     $deltaTime = $endTime - $GLOBALS['startTime'];
     $response_time_string = $GLOBALS['app_strings']['LBL_SERVER_RESPONSE_TIME'] . ' ' . number_format(round($deltaTime, 2), 2) . ' ' . $GLOBALS['app_strings']['LBL_SERVER_RESPONSE_TIME_SECONDS'];
     $return = $response_time_string;
     // $return .= '<br />';
     if (!empty($GLOBALS['sugar_config']['show_page_resources'])) {
         // Print out the resources used in constructing the page.
         $included_files = get_included_files();
         // take all of the included files and make a list that does not allow for duplicates based on case
         // I believe the full get_include_files result set appears to have one entry for each file in real
         // case, and one entry in all lower case.
         $list_of_files_case_insensitive = array();
         foreach ($included_files as $key => $name) {
             // preserve the first capitalization encountered.
             $list_of_files_case_insensitive[mb_strtolower($name)] = $name;
         }
         $return .= $GLOBALS['app_strings']['LBL_SERVER_RESPONSE_RESOURCES'] . '(' . DBManager::getQueryCount() . ',' . sizeof($list_of_files_case_insensitive) . ')<br>';
         // Display performance of the internal and external caches....
         $cacheStats = SugarCache::instance()->getCacheStats();
         $return .= "External cache (hits/total=ratio) local ({$cacheStats['localHits']}/{$cacheStats['requests']}=" . round($cacheStats['localHits'] * 100 / $cacheStats['requests'], 0) . "%)";
         $return .= " external ({$cacheStats['externalHits']}/{$cacheStats['requests']}=" . round($cacheStats['externalHits'] * 100 / $cacheStats['requests'], 0) . "%)<br />";
         $return .= " misses ({$cacheStats['misses']}/{$cacheStats['requests']}=" . round($cacheStats['misses'] * 100 / $cacheStats['requests'], 0) . "%)<br />";
     }
     $return .= $this->logMemoryStatistics();
     return $return;
 }
Пример #2
0
/**
 * Internal -- This function actually retrieves information from the caches.
 * It is a helper function that provides that actual cache API abstraction.
 *
 * @param unknown_type $key
 * @return unknown
 * @deprecated
 * @see sugar_cache_retrieve
 */
function external_cache_retrieve_helper($key)
{
    return SugarCache::instance()->{$key};
}
Пример #3
0
 protected function assertPreConditions()
 {
     if (isset($GLOBALS['log'])) {
         $GLOBALS['log']->info("START TEST: {$this->getName(false)}");
     }
     SugarCache::instance()->flush();
 }
Пример #4
0
 public function testStoreAndRetrieveWithTTLNull()
 {
     $sc = SugarCache::instance();
     $cacheStub = $this->getMock(get_class($sc), array('_setExternal'));
     $cacheStub->expects($this->once())->method('_setExternal');
     $cacheStub->set($this->_cacheKey1, $this->_cacheValue1, null);
 }
Пример #5
0
 /**
  * Flush the cache in its entirety including the local and external store along with the opcodes.
  */
 function sugar_cache_reset_full()
 {
     SugarCache::instance()->resetFull();
     SugarCache::cleanOpcodes();
 }