aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDiva Canto2009-10-09 13:49:55 -0700
committerDiva Canto2009-10-09 13:49:55 -0700
commitc146f2c8c4eb60d063196972d5c0dd2ec550b27e (patch)
tree749002eca0f224af8f6e8468df8b3f47d960b723
parentPutting this to exactly what it was yesterday around this time, so we can do ... (diff)
downloadopensim-SC_OLD-c146f2c8c4eb60d063196972d5c0dd2ec550b27e.zip
opensim-SC_OLD-c146f2c8c4eb60d063196972d5c0dd2ec550b27e.tar.gz
opensim-SC_OLD-c146f2c8c4eb60d063196972d5c0dd2ec550b27e.tar.bz2
opensim-SC_OLD-c146f2c8c4eb60d063196972d5c0dd2ec550b27e.tar.xz
Use the cache, Luke!
-rw-r--r--OpenSim/Framework/Communications/CommunicationsManager.cs33
1 files changed, 8 insertions, 25 deletions
diff --git a/OpenSim/Framework/Communications/CommunicationsManager.cs b/OpenSim/Framework/Communications/CommunicationsManager.cs
index 2410f31..9c02842 100644
--- a/OpenSim/Framework/Communications/CommunicationsManager.cs
+++ b/OpenSim/Framework/Communications/CommunicationsManager.cs
@@ -210,34 +210,17 @@ namespace OpenSim.Framework.Communications
210 private string[] doUUIDNameRequest(UUID uuid) 210 private string[] doUUIDNameRequest(UUID uuid)
211 { 211 {
212 string[] returnstring = new string[0]; 212 string[] returnstring = new string[0];
213 bool doLookup = false; 213 CachedUserInfo uinfo = UserProfileCacheService.GetUserDetails(uuid);
214 214
215 lock (m_nameRequestCache) 215 if ((uinfo != null) && (uinfo.UserProfile != null))
216 { 216 {
217 if (m_nameRequestCache.ContainsKey(uuid)) 217 returnstring = new string[2];
218 { 218 returnstring[0] = uinfo.UserProfile.FirstName;
219 returnstring = m_nameRequestCache[uuid]; 219 returnstring[1] = uinfo.UserProfile.SurName;
220 } 220 lock (m_nameRequestCache)
221 else
222 {
223 // we don't want to lock the dictionary while we're doing the lookup
224 doLookup = true;
225 }
226 }
227
228 if (doLookup) {
229 UserProfileData profileData = m_userService.GetUserProfile(uuid);
230 if (profileData != null)
231 { 221 {
232 returnstring = new string[2]; 222 if (!m_nameRequestCache.ContainsKey(uuid))
233 // UUID profileId = profileData.ID; 223 m_nameRequestCache.Add(uuid, returnstring);
234 returnstring[0] = profileData.FirstName;
235 returnstring[1] = profileData.SurName;
236 lock (m_nameRequestCache)
237 {
238 if (!m_nameRequestCache.ContainsKey(uuid))
239 m_nameRequestCache.Add(uuid, returnstring);
240 }
241 } 224 }
242 } 225 }
243 226