From 743a9d617e92f2ccd01816aec3bef73df22ed534 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 10 Nov 2016 19:21:07 +0000 Subject: also cache not found useraccounts when search by ID. Change the expire time to 5minutes in this case --- .../UserAccounts/LocalUserAccountServiceConnector.cs | 5 +---- .../UserAccounts/RemoteUserAccountServiceConnector.cs | 10 +++------- .../ServiceConnectorsOut/UserAccounts/UserAccountCache.cs | 9 +++++++-- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/LocalUserAccountServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/LocalUserAccountServiceConnector.cs index a413a8b..9325de9 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/LocalUserAccountServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/LocalUserAccountServiceConnector.cs @@ -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; } diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/RemoteUserAccountServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/RemoteUserAccountServiceConnector.cs index 60dd97a..e84b666 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/RemoteUserAccountServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/RemoteUserAccountServiceConnector.cs @@ -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); } } } diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs index 97baf87..f514bd7 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs @@ -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); } -- cgit v1.1