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,10 +213,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts
{
ret.AddRange(ext);
foreach(UserAccount acc in ext)
{
if(acc != null)
m_Cache.Cache(acc.PrincipalID, acc);
}
m_Cache.Cache(acc.PrincipalID, acc);
}
return ret;
}

View File

@ -142,8 +142,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts
return account;
account = base.GetUserAccount(scopeID, userID);
if(account != null)
m_Cache.Cache(userID, account);
m_Cache.Cache(userID, account);
return account;
}
@ -191,11 +190,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts
{
foreach(UserAccount acc in ext)
{
if(acc != null)
{
accs.Add(acc);
m_Cache.Cache(acc.PrincipalID, acc);
}
accs.Add(acc);
m_Cache.Cache(acc.PrincipalID, acc);
}
}
}

View File

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