Compiler and co: fixed issue with the reset of the APC cache

SVN:trunk[1990]
This commit is contained in:
Romain Quetiez
2012-05-14 15:56:06 +00:00
parent 719870663a
commit c7db32f845
2 changed files with 10 additions and 10 deletions

View File

@@ -4786,15 +4786,15 @@ abstract class MetaModel
return $oInstance;
}
public static function GetCacheEntries(Config $oConfig = null)
public static function GetCacheEntries($sEnvironment = null)
{
if (!function_exists('apc_cache_info')) return array();
if (is_null($oConfig))
if (is_null($sEnvironment))
{
$oConfig = self::GetConfig();
$sEnvironment = MetaModel::GetEnvironmentId();
}
$aCacheUserData = apc_cache_info('user');
$sPrefix = 'itop-'.MetaModel::GetEnvironmentId().'-';
$sPrefix = 'itop-'.$sEnvironment.'-';
$aEntries = array();
foreach($aCacheUserData['cache_list'] as $i => $aEntry)
@@ -4809,18 +4809,18 @@ abstract class MetaModel
return $aEntries;
}
public static function ResetCache(Config $oConfig = null)
public static function ResetCache($sEnvironment = null)
{
if (!function_exists('apc_delete')) return;
if (is_null($oConfig))
if (is_null($sEnvironment))
{
$oConfig = self::GetConfig();
$sEnvironment = MetaModel::GetEnvironmentId();
}
$sAppIdentity = 'itop-'.MetaModel::GetEnvironmentId();
$sAppIdentity = 'itop-'.$sEnvironment;
Dict::ResetCache($sAppIdentity);
foreach(self::GetCacheEntries($oConfig) as $sKey => $aAPCInfo)
foreach(self::GetCacheEntries($sEnvironment) as $sKey => $aAPCInfo)
{
$sAPCKey = $aAPCInfo['info'];
apc_delete($sAPCKey);

View File

@@ -79,7 +79,7 @@ class RunTimeEnvironment
if (!$bUseCache)
{
// Reset the cache for the first use !
MetaModel::ResetCache($oConfig);
MetaModel::ResetCache($this->sTargetEnv);
}
MetaModel::Startup($oConfig, $bModelOnly, $bUseCache);