From e00f1a0410a3f57dea4a0cae1376a5d73609d75b Mon Sep 17 00:00:00 2001 From: Oren Hurvitz Date: Mon, 7 Apr 2014 15:01:06 +0300 Subject: Allow invalidating the users cache --- .../UserAccounts/LocalUserAccountServiceConnector.cs | 10 +++++++++- .../ServiceConnectorsOut/UserAccounts/UserAccountCache.cs | 7 ++++++- .../Connectors/SimianGrid/SimianUserAccountServiceConnector.cs | 5 +++++ .../Connectors/UserAccounts/UserAccountServicesConnector.cs | 4 ++++ OpenSim/Services/HypergridService/UserAccountCache.cs | 7 ++++++- OpenSim/Services/Interfaces/IUserAccountService.cs | 2 ++ OpenSim/Services/UserAccountService/UserAccountService.cs | 4 ++++ 7 files changed, 36 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/LocalUserAccountServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/LocalUserAccountServiceConnector.cs index 529bfd7..6d4ac39 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/LocalUserAccountServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/LocalUserAccountServiceConnector.cs @@ -190,7 +190,15 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts // public bool StoreUserAccount(UserAccount data) { - return UserAccountService.StoreUserAccount(data); + bool ret = UserAccountService.StoreUserAccount(data); + if (ret) + m_Cache.Cache(data.PrincipalID, data); + return ret; + } + + public void InvalidateCache(UUID userID) + { + m_Cache.Invalidate(userID); } #endregion diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs index ddef75f..ed52e48 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs @@ -1,4 +1,4 @@ -/* +/* * Copyright (c) Contributors, http://opensimulator.org/ * See CONTRIBUTORS.TXT for a full list of copyright holders. * @@ -61,6 +61,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts //m_log.DebugFormat("[USER CACHE]: cached user {0}", userID); } + public void Invalidate(UUID userID) + { + m_UUIDCache.Remove(userID); + } + public UserAccount Get(UUID userID, out bool inCache) { UserAccount account = null; diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs index 7e36c69..698c4c0 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs @@ -191,6 +191,11 @@ namespace OpenSim.Services.Connectors.SimianGrid return accounts; } + public void InvalidateCache(UUID userID) + { + m_accountCache.Remove(userID); + } + public bool StoreUserAccount(UserAccount data) { // m_log.InfoFormat("[SIMIAN ACCOUNT CONNECTOR]: Storing user account for " + data.Name); diff --git a/OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs b/OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs index 97d9458..8110fe5 100644 --- a/OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs +++ b/OpenSim/Services/Connectors/UserAccounts/UserAccountServicesConnector.cs @@ -187,6 +187,10 @@ namespace OpenSim.Services.Connectors return accounts; } + public void InvalidateCache(UUID userID) + { + } + public virtual bool StoreUserAccount(UserAccount data) { Dictionary sendData = new Dictionary(); diff --git a/OpenSim/Services/HypergridService/UserAccountCache.cs b/OpenSim/Services/HypergridService/UserAccountCache.cs index 65f9dd5..fa7dd0b 100644 --- a/OpenSim/Services/HypergridService/UserAccountCache.cs +++ b/OpenSim/Services/HypergridService/UserAccountCache.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Reflection; @@ -95,6 +95,11 @@ namespace OpenSim.Services.HypergridService return null; } + public void InvalidateCache(UUID userID) + { + m_UUIDCache.Remove(userID); + } + public bool StoreUserAccount(UserAccount data) { return false; diff --git a/OpenSim/Services/Interfaces/IUserAccountService.cs b/OpenSim/Services/Interfaces/IUserAccountService.cs index 1b85980..2f7702c 100644 --- a/OpenSim/Services/Interfaces/IUserAccountService.cs +++ b/OpenSim/Services/Interfaces/IUserAccountService.cs @@ -189,5 +189,7 @@ namespace OpenSim.Services.Interfaces /// /// bool StoreUserAccount(UserAccount data); + + void InvalidateCache(UUID userID); } } diff --git a/OpenSim/Services/UserAccountService/UserAccountService.cs b/OpenSim/Services/UserAccountService/UserAccountService.cs index 1852e4f..40d8095 100644 --- a/OpenSim/Services/UserAccountService/UserAccountService.cs +++ b/OpenSim/Services/UserAccountService/UserAccountService.cs @@ -256,6 +256,10 @@ namespace OpenSim.Services.UserAccountService return MakeUserAccount(d[0]); } + public void InvalidateCache(UUID userID) + { + } + public bool StoreUserAccount(UserAccount data) { // m_log.DebugFormat( -- cgit v1.1