diff options
author | Melanie | 2012-02-24 18:17:30 +0100 |
---|---|---|
committer | Melanie | 2012-02-24 18:17:30 +0100 |
commit | 95f43ab73ebac860cbcd534f07d60404f257b0bb (patch) | |
tree | c95d791e8118309c65bcada6ae325675b7b16a98 /OpenSim/Services/Connectors/Grid/GridServiceConnector.cs | |
parent | stop using useless geom tricallback. (diff) | |
download | opensim-SC-95f43ab73ebac860cbcd534f07d60404f257b0bb.zip opensim-SC-95f43ab73ebac860cbcd534f07d60404f257b0bb.tar.gz opensim-SC-95f43ab73ebac860cbcd534f07d60404f257b0bb.tar.bz2 opensim-SC-95f43ab73ebac860cbcd534f07d60404f257b0bb.tar.xz |
Add a cache on GridService requests
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Services/Connectors/Grid/GridServiceConnector.cs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs b/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs index 1599a56..7deaf95 100644 --- a/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs +++ b/OpenSim/Services/Connectors/Grid/GridServiceConnector.cs | |||
@@ -48,6 +48,9 @@ namespace OpenSim.Services.Connectors | |||
48 | 48 | ||
49 | private string m_ServerURI = String.Empty; | 49 | private string m_ServerURI = String.Empty; |
50 | 50 | ||
51 | private ExpiringCache<ulong, GridRegion> m_regionCache = | ||
52 | new ExpiringCache<ulong, GridRegion>(); | ||
53 | |||
51 | public GridServicesConnector() | 54 | public GridServicesConnector() |
52 | { | 55 | { |
53 | } | 56 | } |
@@ -265,6 +268,11 @@ namespace OpenSim.Services.Connectors | |||
265 | 268 | ||
266 | public GridRegion GetRegionByPosition(UUID scopeID, int x, int y) | 269 | public GridRegion GetRegionByPosition(UUID scopeID, int x, int y) |
267 | { | 270 | { |
271 | ulong regionHandle = Util.UIntsToLong((uint)x, (uint)y); | ||
272 | |||
273 | if (m_regionCache.Contains(regionHandle)) | ||
274 | return (GridRegion)m_regionCache[regionHandle]; | ||
275 | |||
268 | Dictionary<string, object> sendData = new Dictionary<string, object>(); | 276 | Dictionary<string, object> sendData = new Dictionary<string, object>(); |
269 | 277 | ||
270 | sendData["SCOPEID"] = scopeID.ToString(); | 278 | sendData["SCOPEID"] = scopeID.ToString(); |
@@ -306,6 +314,8 @@ namespace OpenSim.Services.Connectors | |||
306 | else | 314 | else |
307 | m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByPosition received null reply"); | 315 | m_log.DebugFormat("[GRID CONNECTOR]: GetRegionByPosition received null reply"); |
308 | 316 | ||
317 | m_regionCache.Add(regionHandle, rinfo, TimeSpan.FromSeconds(600)); | ||
318 | |||
309 | return rinfo; | 319 | return rinfo; |
310 | } | 320 | } |
311 | 321 | ||