Bladeren bron

N.1065 Fix performance issues.
* Does not cache requests containing "id IN ..." (too specific)

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@5012 a333f486-631f-4898-b8df-5754b55c2be0

eespie 7 jaren geleden
bovenliggende
commit
8ead6cc149
1 gewijzigde bestanden met toevoegingen van 8 en 1 verwijderingen
  1. 8 1
      core/dbobjectsearch.class.php

+ 8 - 1
core/dbobjectsearch.class.php

@@ -1467,6 +1467,7 @@ class DBObjectSearch extends DBSearch
 		// Create a unique cache id
 		//
 		$aContextData = array();
+		$bCanCache = true;
 		if (self::$m_bQueryCacheEnabled || self::$m_bTraceQueries)
 		{
 			if (!empty($_SERVER['REQUEST_URI']))
@@ -1480,6 +1481,12 @@ class DBObjectSearch extends DBSearch
 
 			// Need to identify the query
 			$sOqlQuery = $oSearch->ToOql(false, null, true);
+			if (strpos($sOqlQuery, '`id` IN ('))
+			{
+				// Requests containing "id IN" are not worth caching
+				$bCanCache = false;
+			}
+
 			$aContextData['sOqlQuery'] = $sOqlQuery;
 
 			if (count($aModifierProperties))
@@ -1574,7 +1581,7 @@ class DBObjectSearch extends DBSearch
 
 			if (self::$m_bQueryCacheEnabled)
 			{
-				if (self::$m_bUseAPCCache)
+				if ($bCanCache && self::$m_bUseAPCCache)
 				{
 					$oSQLQuery->m_aContextData = $aContextData;
 					$oKPI = new ExecutionKPI();