APC cache: fixed an issue with cache reset

SVN:trunk[1167]
This commit is contained in:
Romain Quetiez
2011-04-04 08:58:59 +00:00
parent 195c1dabf8
commit 44f661cea4

View File

@@ -4130,9 +4130,14 @@ abstract class MetaModel
}
}
public static function GetCacheEntries($sAppIdentity)
public static function GetCacheEntries(Config $oConfig = null)
{
if (!function_exists('apc_cache_info')) return array();
if (is_null($oConfig))
{
$oConfig = self::GetConfig();
}
$sAppIdentity = $oConfig->Get('session_name');
$aCacheUserData = apc_cache_info('user');
$sPrefix = $sAppIdentity.'-';
@@ -4150,14 +4155,18 @@ abstract class MetaModel
return $aEntries;
}
public static function ResetCache(Config $oConfig)
public static function ResetCache(Config $oConfig = null)
{
if (!function_exists('apc_delete')) return;
if (is_null($oConfig))
{
$oConfig = self::GetConfig();
}
$sAppIdentity = $oConfig->Get('session_name');
Dict::ResetCache($sAppIdentity);
foreach(self::GetCacheEntries($sAppIdentity) as $sKey => $aAPCInfo)
foreach(self::GetCacheEntries($oConfig) as $sKey => $aAPCInfo)
{
$sAPCKey = $aAPCInfo['info'];
apc_delete($sAPCKey);