N.1065 Fix performance issues.

* Does not cache requests containing "id IN ..." (too specific)

SVN:trunk[5012]
This commit is contained in:
Eric Espié
2017-10-12 11:58:48 +00:00
parent 5c734cdabc
commit e04e5913de

View File

@@ -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();