diff options
-rw-r--r-- | OpenSim/Region/CoreModules/World/Land/LandObject.cs | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs index e86887d..1f3f075 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs | |||
@@ -56,6 +56,9 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
56 | protected List<SceneObjectGroup> primsOverMe = new List<SceneObjectGroup>(); | 56 | protected List<SceneObjectGroup> primsOverMe = new List<SceneObjectGroup>(); |
57 | protected Dictionary<uint, UUID> m_listTransactions = new Dictionary<uint, UUID>(); | 57 | protected Dictionary<uint, UUID> m_listTransactions = new Dictionary<uint, UUID>(); |
58 | 58 | ||
59 | protected ExpiringCache<UUID, bool> m_groupMemberCache = new ExpiringCache<UUID, bool>(); | ||
60 | protected TimeSpan m_groupMemberCacheTimeout = TimeSpan.FromSeconds(30); // cache invalidation after 30 seconds | ||
61 | |||
59 | public bool[,] LandBitmap | 62 | public bool[,] LandBitmap |
60 | { | 63 | { |
61 | get { return m_landBitmap; } | 64 | get { return m_landBitmap; } |
@@ -442,19 +445,30 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
442 | ScenePresence sp; | 445 | ScenePresence sp; |
443 | if (!m_scene.TryGetScenePresence(avatar, out sp)) | 446 | if (!m_scene.TryGetScenePresence(avatar, out sp)) |
444 | { | 447 | { |
448 | bool isMember; | ||
449 | if (m_groupMemberCache.TryGetValue(avatar, out isMember)) | ||
450 | return isMember; | ||
451 | |||
445 | IGroupsModule groupsModule = m_scene.RequestModuleInterface<IGroupsModule>(); | 452 | IGroupsModule groupsModule = m_scene.RequestModuleInterface<IGroupsModule>(); |
446 | if (groupsModule == null) | 453 | if (groupsModule == null) |
447 | return false; | 454 | return false; |
448 | 455 | ||
449 | GroupMembershipData[] membership = groupsModule.GetMembershipData(avatar); | 456 | GroupMembershipData[] membership = groupsModule.GetMembershipData(avatar); |
450 | if (membership == null || membership.Length == 0) | 457 | if (membership == null || membership.Length == 0) |
458 | { | ||
459 | m_groupMemberCache.Add(avatar, false, m_groupMemberCacheTimeout); | ||
451 | return false; | 460 | return false; |
461 | } | ||
452 | 462 | ||
453 | foreach (GroupMembershipData d in membership) | 463 | foreach (GroupMembershipData d in membership) |
454 | { | 464 | { |
455 | if (d.GroupID == LandData.GroupID) | 465 | if (d.GroupID == LandData.GroupID) |
466 | { | ||
467 | m_groupMemberCache.Add(avatar, false, m_groupMemberCacheTimeout); | ||
456 | return true; | 468 | return true; |
469 | } | ||
457 | } | 470 | } |
471 | m_groupMemberCache.Add(avatar, false, m_groupMemberCacheTimeout); | ||
458 | return false; | 472 | return false; |
459 | } | 473 | } |
460 | 474 | ||
@@ -512,7 +526,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
512 | if (HasGroupAccess(avatar)) | 526 | if (HasGroupAccess(avatar)) |
513 | return false; | 527 | return false; |
514 | 528 | ||
515 | return (!IsInLandAccessList(avatar)); | 529 | return !IsInLandAccessList(avatar); |
516 | } | 530 | } |
517 | 531 | ||
518 | public bool IsInLandAccessList(UUID avatar) | 532 | public bool IsInLandAccessList(UUID avatar) |