diff options
author | UbitUmarov | 2016-11-18 15:16:11 +0000 |
---|---|---|
committer | UbitUmarov | 2016-11-18 15:16:11 +0000 |
commit | b43f36abf168a0cce7e71178e3d4766a717c7d60 (patch) | |
tree | 3156b902c61f8fa672b54f5d4363bd53f4ad9572 /OpenSim/Region | |
parent | avoid a null ref. (needs better way) (diff) | |
download | opensim-SC_OLD-b43f36abf168a0cce7e71178e3d4766a717c7d60.zip opensim-SC_OLD-b43f36abf168a0cce7e71178e3d4766a717c7d60.tar.gz opensim-SC_OLD-b43f36abf168a0cce7e71178e3d4766a717c7d60.tar.bz2 opensim-SC_OLD-b43f36abf168a0cce7e71178e3d4766a717c7d60.tar.xz |
add expire time for aliens
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs | 33 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Interfaces/IUserAccountCacheModule.cs | 2 |
2 files changed, 28 insertions, 7 deletions
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs index 6c1cc52..2afd74e 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs | |||
@@ -36,6 +36,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts | |||
36 | { | 36 | { |
37 | public class UserAccountCache : IUserAccountCacheModule | 37 | public class UserAccountCache : IUserAccountCacheModule |
38 | { | 38 | { |
39 | private const double CACHE_ALIEN_EXPIRATION_SECONDS = 172800; // 48 hours | ||
39 | private const double CACHE_EXPIRATION_SECONDS = 3600.0; // 1 hour! | 40 | private const double CACHE_EXPIRATION_SECONDS = 3600.0; // 1 hour! |
40 | private const double CACHE_NULL_EXPIRATION_SECONDS = 600; // 10minutes | 41 | private const double CACHE_NULL_EXPIRATION_SECONDS = 600; // 10minutes |
41 | 42 | ||
@@ -60,21 +61,20 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts | |||
60 | { | 61 | { |
61 | if (account == null) | 62 | if (account == null) |
62 | m_UUIDCache.AddOrUpdate(userID, null, CACHE_NULL_EXPIRATION_SECONDS); | 63 | m_UUIDCache.AddOrUpdate(userID, null, CACHE_NULL_EXPIRATION_SECONDS); |
63 | else | 64 | else if(account.LocalToGrid) |
64 | { | 65 | { |
65 | m_UUIDCache.AddOrUpdate(userID, account, CACHE_EXPIRATION_SECONDS); | 66 | m_UUIDCache.AddOrUpdate(userID, account, CACHE_EXPIRATION_SECONDS); |
66 | m_NameCache.AddOrUpdate(account.Name, account.PrincipalID, CACHE_EXPIRATION_SECONDS); | 67 | m_NameCache.AddOrUpdate(account.Name, account.PrincipalID, CACHE_EXPIRATION_SECONDS); |
67 | } | 68 | } |
68 | 69 | else | |
70 | { | ||
71 | m_UUIDCache.AddOrUpdate(userID, account, CACHE_ALIEN_EXPIRATION_SECONDS); | ||
72 | m_NameCache.AddOrUpdate(account.Name, account.PrincipalID, CACHE_ALIEN_EXPIRATION_SECONDS); | ||
73 | } | ||
69 | //m_log.DebugFormat("[USER CACHE]: cached user {0}", userID); | 74 | //m_log.DebugFormat("[USER CACHE]: cached user {0}", userID); |
70 | } | 75 | } |
71 | } | 76 | } |
72 | 77 | ||
73 | public void Invalidate(UUID userID) | ||
74 | { | ||
75 | lock(accessLock) | ||
76 | m_UUIDCache.Remove(userID); | ||
77 | } | ||
78 | 78 | ||
79 | public UserAccount Get(UUID userID, out bool inCache) | 79 | public UserAccount Get(UUID userID, out bool inCache) |
80 | { | 80 | { |
@@ -114,6 +114,25 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts | |||
114 | return null; | 114 | return null; |
115 | } | 115 | } |
116 | 116 | ||
117 | public void Invalidate(UUID userID) | ||
118 | { | ||
119 | m_UUIDCache.Remove(userID); | ||
120 | } | ||
121 | |||
122 | public void Remove(UUID id) | ||
123 | { | ||
124 | lock(accessLock) | ||
125 | { | ||
126 | if (!m_UUIDCache.Contains(id)) | ||
127 | return; | ||
128 | |||
129 | UserAccount account = null; | ||
130 | if (m_UUIDCache.TryGetValue(id, out account) && account != null) | ||
131 | m_NameCache.Remove(account.Name); | ||
132 | m_UUIDCache.Remove(id); | ||
133 | } | ||
134 | } | ||
135 | |||
117 | public void Remove(string name) | 136 | public void Remove(string name) |
118 | { | 137 | { |
119 | lock(accessLock) | 138 | lock(accessLock) |
diff --git a/OpenSim/Region/Framework/Interfaces/IUserAccountCacheModule.cs b/OpenSim/Region/Framework/Interfaces/IUserAccountCacheModule.cs index ed26989..027a7e2 100644 --- a/OpenSim/Region/Framework/Interfaces/IUserAccountCacheModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IUserAccountCacheModule.cs | |||
@@ -26,8 +26,10 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using OpenSim.Region.Framework.Scenes; | 28 | using OpenSim.Region.Framework.Scenes; |
29 | using OpenMetaverse; | ||
29 | 30 | ||
30 | public interface IUserAccountCacheModule | 31 | public interface IUserAccountCacheModule |
31 | { | 32 | { |
32 | void Remove(string name); | 33 | void Remove(string name); |
34 | void Remove(UUID id); | ||
33 | } | 35 | } |