* Cache null account responses in the SimianUserAccountServiceConnector to avoid repeated requests for missing avatar IDs

* Updated to OpenMetaverse r3442 to fix a timezone issue with ExpiringCache
This commit is contained in:
John Hurliman
2010-09-07 14:41:13 -07:00
parent 587bab79b4
commit 9be1c0ff44
11 changed files with 34 additions and 19 deletions

View File

@@ -49,6 +49,8 @@ namespace OpenSim.Services.Connectors.SimianGrid
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
public class SimianUserAccountServiceConnector : IUserAccountService, ISharedRegionModule
{
private const double CACHE_EXPIRATION_SECONDS = 120.0;
private static readonly ILog m_log =
LogManager.GetLogger(
MethodBase.GetCurrentMethod().DeclaringType);
@@ -141,7 +143,15 @@ namespace OpenSim.Services.Connectors.SimianGrid
{ "UserID", userID.ToString() }
};
return GetUser(requestArgs);
account = GetUser(requestArgs);
if (account == null)
{
// Store null responses too, to avoid repeated lookups for missing accounts
m_accountCache.AddOrUpdate(userID, null, CACHE_EXPIRATION_SECONDS);
}
return account;
}
public List<UserAccount> GetUserAccounts(UUID scopeID, string query)
@@ -216,7 +226,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
if (success)
{
// Cache the user account info
m_accountCache.AddOrUpdate(data.PrincipalID, data, DateTime.Now + TimeSpan.FromMinutes(2.0d));
m_accountCache.AddOrUpdate(data.PrincipalID, data, CACHE_EXPIRATION_SECONDS);
}
else
{
@@ -281,7 +291,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
GetFirstLastName(response["Name"].AsString(), out account.FirstName, out account.LastName);
// Cache the user account info
m_accountCache.AddOrUpdate(account.PrincipalID, account, DateTime.Now + TimeSpan.FromMinutes(2.0d));
m_accountCache.AddOrUpdate(account.PrincipalID, account, CACHE_EXPIRATION_SECONDS);
return account;
}