diff options
author | UbitUmarov | 2016-07-30 03:31:03 +0100 |
---|---|---|
committer | UbitUmarov | 2016-07-30 03:31:03 +0100 |
commit | a1759292c811829b3fa5a2016dd0fbb448e81c3c (patch) | |
tree | 54e7dfb4025fa8f88120fb1da87a8d4976530966 /OpenSim | |
parent | add a regionInfoCache get by world 2D position (diff) | |
download | opensim-SC-a1759292c811829b3fa5a2016dd0fbb448e81c3c.zip opensim-SC-a1759292c811829b3fa5a2016dd0fbb448e81c3c.tar.gz opensim-SC-a1759292c811829b3fa5a2016dd0fbb448e81c3c.tar.bz2 opensim-SC-a1759292c811829b3fa5a2016dd0fbb448e81c3c.tar.xz |
add a regionInfoCache cache add region with expire time option
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionInfoCache.cs | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionInfoCache.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionInfoCache.cs index 8403362..77f002e 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionInfoCache.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionInfoCache.cs | |||
@@ -38,7 +38,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid | |||
38 | { | 38 | { |
39 | public class RegionInfoCache | 39 | public class RegionInfoCache |
40 | { | 40 | { |
41 | private const double CACHE_EXPIRATION_SECONDS = 120; // 2 minutes opensim regions change a lot | 41 | private const float CACHE_EXPIRATION_SECONDS = 120; // 2 minutes opensim regions change a lot |
42 | 42 | ||
43 | // private static readonly ILog m_log = | 43 | // private static readonly ILog m_log = |
44 | // LogManager.GetLogger( | 44 | // LogManager.GetLogger( |
@@ -68,6 +68,17 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid | |||
68 | m_Cache.AddOrUpdate(scopeID, rinfo, CACHE_EXPIRATION_SECONDS); | 68 | m_Cache.AddOrUpdate(scopeID, rinfo, CACHE_EXPIRATION_SECONDS); |
69 | } | 69 | } |
70 | 70 | ||
71 | public void Cache(UUID scopeID, UUID regionID, GridRegion rinfo, float expireSeconds) | ||
72 | { | ||
73 | // for now, do not cache negative results; this is because | ||
74 | // we need to figure out how to handle regions coming online | ||
75 | // in a timely way | ||
76 | if (rinfo == null) | ||
77 | return; | ||
78 | |||
79 | m_Cache.AddOrUpdate(scopeID, rinfo, expireSeconds); | ||
80 | } | ||
81 | |||
71 | public GridRegion Get(UUID scopeID, UUID regionID, out bool inCache) | 82 | public GridRegion Get(UUID scopeID, UUID regionID, out bool inCache) |
72 | { | 83 | { |
73 | inCache = false; | 84 | inCache = false; |
@@ -255,7 +266,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid | |||
255 | timer.Start(); | 266 | timer.Start(); |
256 | } | 267 | } |
257 | 268 | ||
258 | public bool Add(UUID scope, GridRegion region, double expirationSeconds) | 269 | public bool Add(UUID scope, GridRegion region, float expirationSeconds) |
259 | { | 270 | { |
260 | if (!Monitor.TryEnter(syncRoot, MAX_LOCK_WAIT)) | 271 | if (!Monitor.TryEnter(syncRoot, MAX_LOCK_WAIT)) |
261 | throw new ApplicationException("Lock could not be acquired after " + MAX_LOCK_WAIT + "ms"); | 272 | throw new ApplicationException("Lock could not be acquired after " + MAX_LOCK_WAIT + "ms"); |
@@ -284,7 +295,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid | |||
284 | finally { Monitor.Exit(syncRoot);} | 295 | finally { Monitor.Exit(syncRoot);} |
285 | } | 296 | } |
286 | 297 | ||
287 | public bool AddOrUpdate(UUID scope, GridRegion region, double expirationSeconds) | 298 | public bool AddOrUpdate(UUID scope, GridRegion region, float expirationSeconds) |
288 | { | 299 | { |
289 | if (!Monitor.TryEnter(syncRoot, MAX_LOCK_WAIT)) | 300 | if (!Monitor.TryEnter(syncRoot, MAX_LOCK_WAIT)) |
290 | throw new ApplicationException("Lock could not be acquired after " + MAX_LOCK_WAIT + "ms"); | 301 | throw new ApplicationException("Lock could not be acquired after " + MAX_LOCK_WAIT + "ms"); |