mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-22 10:08:45 +02:00
Merged from trunk
N.1065 Fix performance issues. * Does not cache requests containing "id IN ..." and "id NOT IN ..." (too specific) [from revisions 5012, 5019] SVN:2.4[5020]
This commit is contained in:
@@ -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 (isset($_SERVER['REQUEST_URI']))
|
||||
@@ -1484,6 +1485,12 @@ class DBObjectSearch extends DBSearch
|
||||
|
||||
// Need to identify the query
|
||||
$sOqlQuery = $oSearch->ToOql(false, null, true);
|
||||
if ((strpos($sOqlQuery, '`id` IN (') !== false) || (strpos($sOqlQuery, '`id` NOT IN (') !== false))
|
||||
{
|
||||
// Requests containing "id IN" are not worth caching
|
||||
$bCanCache = false;
|
||||
}
|
||||
|
||||
$aContextData['sOqlQuery'] = $sOqlQuery;
|
||||
|
||||
if (count($aModifierProperties))
|
||||
@@ -1578,7 +1585,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();
|
||||
|
||||
Reference in New Issue
Block a user