mirror of
https://github.com/opensim/opensim.git
synced 2026-05-15 03:15:41 +08:00
also cache not found useraccounts when search by ID. Change the expire time to 5minutes in this case
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user