28 using System.Reflection;
29 using System.Collections.Generic;
30 using OpenSim.Framework;
31 using OpenSim.Services.Interfaces;
36 namespace OpenSim.
Region.CoreModules.ServiceConnectorsOut.Grid
40 private const double CACHE_EXPIRATION_SECONDS = 300.0;
46 internal struct ScopedRegionUUID
48 public UUID m_scopeID;
49 public UUID m_regionID;
50 public ScopedRegionUUID(UUID scopeID, UUID regionID)
53 m_regionID = regionID;
57 internal struct ScopedRegionName
59 public UUID m_scopeID;
61 public ScopedRegionName(UUID scopeID,
string name)
68 internal struct ScopedRegionPosition
70 public UUID m_scopeID;
71 public ulong m_regionHandle;
72 public ScopedRegionPosition(UUID scopeID, ulong handle)
75 m_regionHandle = handle;
79 private ExpiringCache<ScopedRegionUUID, GridRegion> m_UUIDCache;
80 private ExpiringCache<ScopedRegionName, ScopedRegionUUID> m_NameCache;
81 private ExpiringCache<ScopedRegionPosition, GridRegion> m_PositionCache;
85 m_UUIDCache =
new ExpiringCache<ScopedRegionUUID, GridRegion>();
86 m_NameCache =
new ExpiringCache<ScopedRegionName, ScopedRegionUUID>();
87 m_PositionCache =
new ExpiringCache<ScopedRegionPosition, GridRegion>();
93 this.Cache(rinfo.ScopeID,rinfo.RegionID,rinfo);
104 ScopedRegionUUID
id =
new ScopedRegionUUID(scopeID,regionID);
107 m_UUIDCache.AddOrUpdate(id, rinfo, CACHE_EXPIRATION_SECONDS);
110 ScopedRegionName name =
new ScopedRegionName(scopeID,rinfo.RegionName);
111 m_NameCache.AddOrUpdate(name, id, CACHE_EXPIRATION_SECONDS);
113 ScopedRegionPosition pos =
new ScopedRegionPosition(scopeID, rinfo.RegionHandle);
114 m_PositionCache.AddOrUpdate(pos, rinfo, CACHE_EXPIRATION_SECONDS);
123 ScopedRegionUUID
id =
new ScopedRegionUUID(scopeID,regionID);
124 if (m_UUIDCache.TryGetValue(
id, out rinfo))
138 ScopedRegionPosition pos =
new ScopedRegionPosition(scopeID, handle);
139 if (m_PositionCache.TryGetValue(pos, out rinfo))
153 ScopedRegionName sname =
new ScopedRegionName(scopeID,name);
156 if (m_NameCache.TryGetValue(sname, out
id))
159 if (m_UUIDCache.TryGetValue(
id, out rinfo))
void Cache(GridRegion rinfo)
void Cache(UUID scopeID, UUID regionID, GridRegion rinfo)
GridRegion Get(UUID scopeID, ulong handle, out bool inCache)
GridRegion Get(UUID scopeID, string name, out bool inCache)
OpenSim.Services.Interfaces.GridRegion GridRegion
GridRegion Get(UUID scopeID, UUID regionID, out bool inCache)