diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionInfoCache.cs | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionInfoCache.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionInfoCache.cs index 786e0b5..be8a9a2 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionInfoCache.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionInfoCache.cs | |||
@@ -65,13 +65,26 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid | |||
65 | } | 65 | } |
66 | } | 66 | } |
67 | 67 | ||
68 | internal struct ScopedRegionPosition | ||
69 | { | ||
70 | public UUID m_scopeID; | ||
71 | public ulong m_regionHandle; | ||
72 | public ScopedRegionPosition(UUID scopeID, ulong handle) | ||
73 | { | ||
74 | m_scopeID = scopeID; | ||
75 | m_regionHandle = handle; | ||
76 | } | ||
77 | } | ||
78 | |||
68 | private ExpiringCache<ScopedRegionUUID, GridRegion> m_UUIDCache; | 79 | private ExpiringCache<ScopedRegionUUID, GridRegion> m_UUIDCache; |
69 | private ExpiringCache<ScopedRegionName, ScopedRegionUUID> m_NameCache; | 80 | private ExpiringCache<ScopedRegionName, ScopedRegionUUID> m_NameCache; |
81 | private ExpiringCache<ScopedRegionPosition, GridRegion> m_PositionCache; | ||
70 | 82 | ||
71 | public RegionInfoCache() | 83 | public RegionInfoCache() |
72 | { | 84 | { |
73 | m_UUIDCache = new ExpiringCache<ScopedRegionUUID, GridRegion>(); | 85 | m_UUIDCache = new ExpiringCache<ScopedRegionUUID, GridRegion>(); |
74 | m_NameCache = new ExpiringCache<ScopedRegionName, ScopedRegionUUID>(); | 86 | m_NameCache = new ExpiringCache<ScopedRegionName, ScopedRegionUUID>(); |
87 | m_PositionCache = new ExpiringCache<ScopedRegionPosition, GridRegion>(); | ||
75 | } | 88 | } |
76 | 89 | ||
77 | public void Cache(GridRegion rinfo) | 90 | public void Cache(GridRegion rinfo) |
@@ -96,6 +109,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid | |||
96 | { | 109 | { |
97 | ScopedRegionName name = new ScopedRegionName(scopeID,rinfo.RegionName); | 110 | ScopedRegionName name = new ScopedRegionName(scopeID,rinfo.RegionName); |
98 | m_NameCache.AddOrUpdate(name, id, CACHE_EXPIRATION_SECONDS); | 111 | m_NameCache.AddOrUpdate(name, id, CACHE_EXPIRATION_SECONDS); |
112 | |||
113 | ScopedRegionPosition pos = new ScopedRegionPosition(scopeID, rinfo.RegionHandle); | ||
114 | m_PositionCache.AddOrUpdate(pos, rinfo, CACHE_EXPIRATION_SECONDS); | ||
99 | } | 115 | } |
100 | } | 116 | } |
101 | 117 | ||
@@ -114,6 +130,22 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid | |||
114 | return null; | 130 | return null; |
115 | } | 131 | } |
116 | 132 | ||
133 | public GridRegion Get(UUID scopeID, ulong handle, out bool inCache) | ||
134 | { | ||
135 | inCache = false; | ||
136 | |||
137 | GridRegion rinfo = null; | ||
138 | ScopedRegionPosition pos = new ScopedRegionPosition(scopeID, handle); | ||
139 | if (m_PositionCache.TryGetValue(pos, out rinfo)) | ||
140 | { | ||
141 | inCache = true; | ||
142 | return rinfo; | ||
143 | } | ||
144 | |||
145 | return null; | ||
146 | } | ||
147 | |||
148 | |||
117 | public GridRegion Get(UUID scopeID, string name, out bool inCache) | 149 | public GridRegion Get(UUID scopeID, string name, out bool inCache) |
118 | { | 150 | { |
119 | inCache = false; | 151 | inCache = false; |