Compatibility with APCu (For PHP 5.5+), since it slightly different from APC.

SVN:trunk[3061]
This commit is contained in:
Denis Flaven
2014-01-22 15:18:48 +00:00
parent 0a53f8ec3f
commit 991fe9ccc1

View File

@@ -5248,18 +5248,27 @@ abstract class MetaModel
$sEnvironment = MetaModel::GetEnvironmentId();
}
$aEntries = array();
$aCacheUserData = @apc_cache_info('user');
if (extension_loaded('apcu'))
{
// Beware: APCu behaves slightly differently from APC !!
$aCacheUserData = @apc_cache_info();
}
else
{
$aCacheUserData = @apc_cache_info('user');
}
if (is_array($aCacheUserData) && isset($aCacheUserData['cache_list']))
{
$sPrefix = 'itop-'.$sEnvironment.'-';
foreach($aCacheUserData['cache_list'] as $i => $aEntry)
{
$sEntryKey = $aEntry['info'];
$sEntryKey = array_key_exists('info', $aEntry) ? $aEntry['info'] : $aEntry['key'];
if (strpos($sEntryKey, $sPrefix) === 0)
{
$sCleanKey = substr($sEntryKey, strlen($sPrefix));
$aEntries[$sCleanKey] = $aEntry;
$aEntries[$sCleanKey]['info'] = $sEntryKey;
}
}
}