diff options
Diffstat (limited to 'OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs')
-rw-r--r-- | OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs index fdeea18..a92c4fb 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs | |||
@@ -74,6 +74,9 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
74 | // private object m_gestureSyncRoot = new object(); | 74 | // private object m_gestureSyncRoot = new object(); |
75 | private bool m_Enabled = false; | 75 | private bool m_Enabled = false; |
76 | 76 | ||
77 | private const double CACHE_EXPIRATION_SECONDS = 20.0; | ||
78 | private static ExpiringCache<UUID, InventoryItemBase> m_ItemCache; | ||
79 | |||
77 | #region ISharedRegionModule | 80 | #region ISharedRegionModule |
78 | 81 | ||
79 | public Type ReplaceableInterface { get { return null; } } | 82 | public Type ReplaceableInterface { get { return null; } } |
@@ -99,6 +102,9 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
99 | url = url + '/'; | 102 | url = url + '/'; |
100 | m_serverUrl = url; | 103 | m_serverUrl = url; |
101 | 104 | ||
105 | if (m_ItemCache == null) | ||
106 | m_ItemCache = new ExpiringCache<UUID, InventoryItemBase>(); | ||
107 | |||
102 | } | 108 | } |
103 | 109 | ||
104 | public void Initialise(IConfigSource source) | 110 | public void Initialise(IConfigSource source) |
@@ -132,6 +138,8 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
132 | { | 138 | { |
133 | m_userServerUrl = serviceUrl; | 139 | m_userServerUrl = serviceUrl; |
134 | m_Enabled = true; | 140 | m_Enabled = true; |
141 | if (m_ItemCache == null) | ||
142 | m_ItemCache = new ExpiringCache<UUID, InventoryItemBase>(); | ||
135 | } | 143 | } |
136 | } | 144 | } |
137 | } | 145 | } |
@@ -271,6 +279,10 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
271 | /// <returns></returns> | 279 | /// <returns></returns> |
272 | public InventoryItemBase GetItem(InventoryItemBase item) | 280 | public InventoryItemBase GetItem(InventoryItemBase item) |
273 | { | 281 | { |
282 | InventoryItemBase retrieved = null; | ||
283 | if (m_ItemCache.TryGetValue(item.ID, out retrieved)) | ||
284 | return retrieved; | ||
285 | |||
274 | NameValueCollection requestArgs = new NameValueCollection | 286 | NameValueCollection requestArgs = new NameValueCollection |
275 | { | 287 | { |
276 | { "RequestMethod", "GetInventoryNode" }, | 288 | { "RequestMethod", "GetInventoryNode" }, |
@@ -292,7 +304,11 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
292 | for (int i = 0; i < items.Count; i++) | 304 | for (int i = 0; i < items.Count; i++) |
293 | { | 305 | { |
294 | if (items[i].ID == item.ID) | 306 | if (items[i].ID == item.ID) |
295 | return items[i]; | 307 | { |
308 | retrieved = items[i]; | ||
309 | m_ItemCache.AddOrUpdate(item.ID, retrieved, CACHE_EXPIRATION_SECONDS); | ||
310 | return retrieved; | ||
311 | } | ||
296 | } | 312 | } |
297 | } | 313 | } |
298 | } | 314 | } |