also cache not found useraccounts when search by ID. Change the expire time to 5minutes in this case

melanie
UbitUmarov 2016-11-10 19:21:07 +00:00
parent bddaef5122
commit 743a9d617e
3 changed files with 11 additions and 13 deletions

View File

@ -213,11 +213,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts
{ {
ret.AddRange(ext); ret.AddRange(ext);
foreach(UserAccount acc in ext) foreach(UserAccount acc in ext)
{
if(acc != null)
m_Cache.Cache(acc.PrincipalID, acc); m_Cache.Cache(acc.PrincipalID, acc);
} }
}
return ret; return ret;
} }

View File

@ -142,7 +142,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts
return account; return account;
account = base.GetUserAccount(scopeID, userID); account = base.GetUserAccount(scopeID, userID);
if(account != null)
m_Cache.Cache(userID, account); m_Cache.Cache(userID, account);
return account; return account;
@ -190,15 +189,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts
if(ext != null && ext.Count >0 ) if(ext != null && ext.Count >0 )
{ {
foreach(UserAccount acc in ext) foreach(UserAccount acc in ext)
{
if(acc != null)
{ {
accs.Add(acc); accs.Add(acc);
m_Cache.Cache(acc.PrincipalID, acc); m_Cache.Cache(acc.PrincipalID, acc);
} }
} }
} }
}
return accs; return accs;
} }

View File

@ -37,6 +37,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts
public class UserAccountCache : IUserAccountCacheModule public class UserAccountCache : IUserAccountCacheModule
{ {
private const double CACHE_EXPIRATION_SECONDS = 120000.0; // 33 hours! private const double CACHE_EXPIRATION_SECONDS = 120000.0; // 33 hours!
private const double CACHENULL_EXPIRATION_SECONDS = 600; // 5minutes
// private static readonly ILog m_log = // private static readonly ILog m_log =
// LogManager.GetLogger( // LogManager.GetLogger(
@ -56,10 +57,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts
{ {
// Cache even null accounts // Cache even null accounts
lock(accessLock) lock(accessLock)
{
if (account == null)
m_UUIDCache.AddOrUpdate(userID, null, CACHENULL_EXPIRATION_SECONDS);
else
{ {
m_UUIDCache.AddOrUpdate(userID, account, CACHE_EXPIRATION_SECONDS); m_UUIDCache.AddOrUpdate(userID, account, CACHE_EXPIRATION_SECONDS);
if (account != null)
m_NameCache.AddOrUpdate(account.Name, account.PrincipalID, CACHE_EXPIRATION_SECONDS); m_NameCache.AddOrUpdate(account.Name, account.PrincipalID, CACHE_EXPIRATION_SECONDS);
}
//m_log.DebugFormat("[USER CACHE]: cached user {0}", userID); //m_log.DebugFormat("[USER CACHE]: cached user {0}", userID);
} }