diff options
author | Melanie Thielker | 2017-01-30 13:59:05 +0000 |
---|---|---|
committer | Melanie Thielker | 2017-01-30 13:59:05 +0000 |
commit | 5a18ea31cf9d9a97fc1a65f8623b633c244221c2 (patch) | |
tree | 80eae98cddde4ffbdb7287ad0ac82449c33cb316 | |
parent | Comment two very spammy debug messages that the usr can't do anything about (diff) | |
download | opensim-SC-5a18ea31cf9d9a97fc1a65f8623b633c244221c2.zip opensim-SC-5a18ea31cf9d9a97fc1a65f8623b633c244221c2.tar.gz opensim-SC-5a18ea31cf9d9a97fc1a65f8623b633c244221c2.tar.bz2 opensim-SC-5a18ea31cf9d9a97fc1a65f8623b633c244221c2.tar.xz |
Make negative asset caching actually work
Also fixes some merge artefacts in HGAssetBroker where cached assets
were requested but not actually used and completely squelch a materials
debug message because there is nothing the user can do to fix it anyway.
13 files changed, 147 insertions, 45 deletions
diff --git a/OpenSim/Framework/IAssetCache.cs b/OpenSim/Framework/IAssetCache.cs index 8477116..1e6d19d 100644 --- a/OpenSim/Framework/IAssetCache.cs +++ b/OpenSim/Framework/IAssetCache.cs | |||
@@ -48,7 +48,7 @@ namespace OpenSim.Framework | |||
48 | /// </summary> | 48 | /// </summary> |
49 | /// <param name='id'></param> | 49 | /// <param name='id'></param> |
50 | /// <returns>null if the asset does not exist.</returns> | 50 | /// <returns>null if the asset does not exist.</returns> |
51 | AssetBase Get(string id); | 51 | AssetBase Get(string id, out bool negative); |
52 | 52 | ||
53 | /// <summary> | 53 | /// <summary> |
54 | /// Check whether an asset with the specified id exists in the cache. | 54 | /// Check whether an asset with the specified id exists in the cache. |
diff --git a/OpenSim/Framework/WearableCacheItem.cs b/OpenSim/Framework/WearableCacheItem.cs index ccaf69e..f181c39 100644 --- a/OpenSim/Framework/WearableCacheItem.cs +++ b/OpenSim/Framework/WearableCacheItem.cs | |||
@@ -113,7 +113,8 @@ namespace OpenSim.Framework | |||
113 | { | 113 | { |
114 | if (dataCache.Check(item.TextureID.ToString())) | 114 | if (dataCache.Check(item.TextureID.ToString())) |
115 | { | 115 | { |
116 | AssetBase assetItem = dataCache.Get(item.TextureID.ToString()); | 116 | bool negative; |
117 | AssetBase assetItem = dataCache.Get(item.TextureID.ToString(), out negative); | ||
117 | if (assetItem != null) | 118 | if (assetItem != null) |
118 | { | 119 | { |
119 | itemmap.Add("assetdata", OSD.FromBinary(assetItem.Data)); | 120 | itemmap.Add("assetdata", OSD.FromBinary(assetItem.Data)); |
diff --git a/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs b/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs index 2242e42..594b6bb 100644 --- a/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs +++ b/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs | |||
@@ -369,7 +369,8 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender | |||
369 | else if (Cache != null) | 369 | else if (Cache != null) |
370 | { | 370 | { |
371 | string assetName = "j2kCache_" + AssetId.ToString(); | 371 | string assetName = "j2kCache_" + AssetId.ToString(); |
372 | AssetBase layerDecodeAsset = Cache.Get(assetName); | 372 | bool negative; |
373 | AssetBase layerDecodeAsset = Cache.Get(assetName, out negative); | ||
373 | 374 | ||
374 | if (layerDecodeAsset != null) | 375 | if (layerDecodeAsset != null) |
375 | { | 376 | { |
diff --git a/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs b/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs index 23c1f03..136134f 100644 --- a/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs +++ b/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs | |||
@@ -260,8 +260,10 @@ namespace OpenSim.Region.CoreModules.Asset | |||
260 | /// Cache doesn't guarantee in any situation that asset is stored to it. | 260 | /// Cache doesn't guarantee in any situation that asset is stored to it. |
261 | /// </para> | 261 | /// </para> |
262 | /// </remarks> | 262 | /// </remarks> |
263 | public AssetBase Get(string id) | 263 | public AssetBase Get(string id, out bool negative) |
264 | { | 264 | { |
265 | negative = false; | ||
266 | |||
265 | m_getCount++; | 267 | m_getCount++; |
266 | AssetBase assetBase; | 268 | AssetBase assetBase; |
267 | if (m_cache.TryGetValue(id, out assetBase)) | 269 | if (m_cache.TryGetValue(id, out assetBase)) |
diff --git a/OpenSim/Region/CoreModules/Asset/CoreAssetCache.cs b/OpenSim/Region/CoreModules/Asset/CoreAssetCache.cs index 51fc3d1..d655509 100644 --- a/OpenSim/Region/CoreModules/Asset/CoreAssetCache.cs +++ b/OpenSim/Region/CoreModules/Asset/CoreAssetCache.cs | |||
@@ -115,7 +115,8 @@ namespace OpenSim.Region.CoreModules.Asset | |||
115 | public bool Check(string id) | 115 | public bool Check(string id) |
116 | { | 116 | { |
117 | // XXX This is probably not an efficient implementation. | 117 | // XXX This is probably not an efficient implementation. |
118 | return Get(id) != null; | 118 | bool negative; |
119 | return Get(id, out negative) != null; | ||
119 | } | 120 | } |
120 | 121 | ||
121 | public void Cache(AssetBase asset) | 122 | public void Cache(AssetBase asset) |
@@ -129,8 +130,9 @@ namespace OpenSim.Region.CoreModules.Asset | |||
129 | // We don't do negative caching | 130 | // We don't do negative caching |
130 | } | 131 | } |
131 | 132 | ||
132 | public AssetBase Get(string id) | 133 | public AssetBase Get(string id, out bool negative) |
133 | { | 134 | { |
135 | negative = false; | ||
134 | return (AssetBase)m_Cache.Get(id); | 136 | return (AssetBase)m_Cache.Get(id); |
135 | } | 137 | } |
136 | 138 | ||
diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs index 187f090..b183a75 100644 --- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs +++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs | |||
@@ -474,6 +474,8 @@ namespace OpenSim.Region.CoreModules.Asset | |||
474 | { | 474 | { |
475 | using (FileStream stream = File.Open(filename, FileMode.Open, FileAccess.Read, FileShare.Read)) | 475 | using (FileStream stream = File.Open(filename, FileMode.Open, FileAccess.Read, FileShare.Read)) |
476 | { | 476 | { |
477 | if (stream.Length == 0) // Empty file will trigger exception below | ||
478 | return null; | ||
477 | BinaryFormatter bformatter = new BinaryFormatter(); | 479 | BinaryFormatter bformatter = new BinaryFormatter(); |
478 | 480 | ||
479 | asset = (AssetBase)bformatter.Deserialize(stream); | 481 | asset = (AssetBase)bformatter.Deserialize(stream); |
@@ -531,13 +533,25 @@ namespace OpenSim.Region.CoreModules.Asset | |||
531 | return found; | 533 | return found; |
532 | } | 534 | } |
533 | 535 | ||
536 | // For IAssetService | ||
534 | public AssetBase Get(string id) | 537 | public AssetBase Get(string id) |
535 | { | 538 | { |
539 | bool negative; | ||
540 | return Get(id, out negative); | ||
541 | } | ||
542 | |||
543 | public AssetBase Get(string id, out bool negative) | ||
544 | { | ||
545 | negative = false; | ||
546 | |||
536 | m_Requests++; | 547 | m_Requests++; |
537 | 548 | ||
538 | object dummy; | 549 | object dummy; |
539 | if (m_negativeCache.TryGetValue(id, out dummy)) | 550 | if (m_negativeCache.TryGetValue(id, out dummy)) |
551 | { | ||
552 | negative = true; | ||
540 | return null; | 553 | return null; |
554 | } | ||
541 | 555 | ||
542 | AssetBase asset = null; | 556 | AssetBase asset = null; |
543 | asset = GetFromWeakReference(id); | 557 | asset = GetFromWeakReference(id); |
@@ -578,12 +592,6 @@ namespace OpenSim.Region.CoreModules.Asset | |||
578 | GenerateCacheHitReport().ForEach(l => m_log.InfoFormat("[FLOTSAM ASSET CACHE]: {0}", l)); | 592 | GenerateCacheHitReport().ForEach(l => m_log.InfoFormat("[FLOTSAM ASSET CACHE]: {0}", l)); |
579 | } | 593 | } |
580 | 594 | ||
581 | if(asset == null) | ||
582 | { | ||
583 | |||
584 | |||
585 | } | ||
586 | |||
587 | return asset; | 595 | return asset; |
588 | } | 596 | } |
589 | 597 | ||
@@ -599,7 +607,8 @@ namespace OpenSim.Region.CoreModules.Asset | |||
599 | 607 | ||
600 | public AssetBase GetCached(string id) | 608 | public AssetBase GetCached(string id) |
601 | { | 609 | { |
602 | return Get(id); | 610 | bool negative; |
611 | return Get(id, out negative); | ||
603 | } | 612 | } |
604 | 613 | ||
605 | public void Expire(string id) | 614 | public void Expire(string id) |
@@ -1227,19 +1236,24 @@ namespace OpenSim.Region.CoreModules.Asset | |||
1227 | 1236 | ||
1228 | public AssetMetadata GetMetadata(string id) | 1237 | public AssetMetadata GetMetadata(string id) |
1229 | { | 1238 | { |
1230 | AssetBase asset = Get(id); | 1239 | bool negative; |
1240 | AssetBase asset = Get(id, out negative); | ||
1231 | return asset.Metadata; | 1241 | return asset.Metadata; |
1232 | } | 1242 | } |
1233 | 1243 | ||
1234 | public byte[] GetData(string id) | 1244 | public byte[] GetData(string id) |
1235 | { | 1245 | { |
1236 | AssetBase asset = Get(id); | 1246 | bool negative; |
1247 | AssetBase asset = Get(id, out negative); | ||
1237 | return asset.Data; | 1248 | return asset.Data; |
1238 | } | 1249 | } |
1239 | 1250 | ||
1240 | public bool Get(string id, object sender, AssetRetrieved handler) | 1251 | public bool Get(string id, object sender, AssetRetrieved handler) |
1241 | { | 1252 | { |
1242 | AssetBase asset = Get(id); | 1253 | bool negative; |
1254 | AssetBase asset = Get(id, out negative); | ||
1255 | if (negative) | ||
1256 | return false; | ||
1243 | handler(id, sender, asset); | 1257 | handler(id, sender, asset); |
1244 | return true; | 1258 | return true; |
1245 | } | 1259 | } |
@@ -1270,7 +1284,8 @@ namespace OpenSim.Region.CoreModules.Asset | |||
1270 | 1284 | ||
1271 | public bool UpdateContent(string id, byte[] data) | 1285 | public bool UpdateContent(string id, byte[] data) |
1272 | { | 1286 | { |
1273 | AssetBase asset = Get(id); | 1287 | bool negative; |
1288 | AssetBase asset = Get(id, out negative); | ||
1274 | asset.Data = data; | 1289 | asset.Data = data; |
1275 | Cache(asset); | 1290 | Cache(asset); |
1276 | return true; | 1291 | return true; |
diff --git a/OpenSim/Region/CoreModules/Asset/GlynnTuckerAssetCache.cs b/OpenSim/Region/CoreModules/Asset/GlynnTuckerAssetCache.cs index 208963d..342d4d9 100644 --- a/OpenSim/Region/CoreModules/Asset/GlynnTuckerAssetCache.cs +++ b/OpenSim/Region/CoreModules/Asset/GlynnTuckerAssetCache.cs | |||
@@ -131,8 +131,10 @@ namespace OpenSim.Region.CoreModules.Asset | |||
131 | // We don't do negative caching | 131 | // We don't do negative caching |
132 | } | 132 | } |
133 | 133 | ||
134 | public AssetBase Get(string id) | 134 | public AssetBase Get(string id, out bool negative) |
135 | { | 135 | { |
136 | negative = false; | ||
137 | |||
136 | Object asset = null; | 138 | Object asset = null; |
137 | m_Cache.TryGet(id, out asset); | 139 | m_Cache.TryGet(id, out asset); |
138 | 140 | ||
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index fb408a4..3e47782 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs | |||
@@ -299,7 +299,8 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
299 | if (bakedTextureFace == null) | 299 | if (bakedTextureFace == null) |
300 | continue; | 300 | continue; |
301 | 301 | ||
302 | AssetBase asset = cache.Get(bakedTextureFace.TextureID.ToString()); | 302 | bool negative; |
303 | AssetBase asset = cache.Get(bakedTextureFace.TextureID.ToString(), out negative); | ||
303 | 304 | ||
304 | if (asset != null && asset.Local) | 305 | if (asset != null && asset.Local) |
305 | { | 306 | { |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs index f5aa971..ce61ff0 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs | |||
@@ -209,7 +209,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset | |||
209 | 209 | ||
210 | if (m_Cache != null) | 210 | if (m_Cache != null) |
211 | { | 211 | { |
212 | asset = m_Cache.Get(id); | 212 | bool negative; |
213 | asset = m_Cache.Get(id, out negative); | ||
214 | |||
215 | if (negative) | ||
216 | return null; | ||
213 | 217 | ||
214 | if (asset != null) | 218 | if (asset != null) |
215 | return asset; | 219 | return asset; |
@@ -238,8 +242,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset | |||
238 | 242 | ||
239 | public AssetBase GetCached(string id) | 243 | public AssetBase GetCached(string id) |
240 | { | 244 | { |
245 | bool negative; | ||
241 | if (m_Cache != null) | 246 | if (m_Cache != null) |
242 | return m_Cache.Get(id); | 247 | return m_Cache.Get(id, out negative); |
243 | 248 | ||
244 | return null; | 249 | return null; |
245 | } | 250 | } |
@@ -250,8 +255,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset | |||
250 | 255 | ||
251 | if (m_Cache != null) | 256 | if (m_Cache != null) |
252 | { | 257 | { |
253 | if (m_Cache != null) | 258 | bool negative; |
254 | m_Cache.Get(id); | 259 | asset = m_Cache.Get(id, out negative); |
260 | |||
261 | if (negative) | ||
262 | return null; | ||
255 | 263 | ||
256 | if (asset != null) | 264 | if (asset != null) |
257 | return asset.Metadata; | 265 | return asset.Metadata; |
@@ -273,8 +281,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset | |||
273 | 281 | ||
274 | if (m_Cache != null) | 282 | if (m_Cache != null) |
275 | { | 283 | { |
276 | if (m_Cache != null) | 284 | bool negative; |
277 | m_Cache.Get(id); | 285 | asset = m_Cache.Get(id, out negative); |
286 | |||
287 | if (negative) | ||
288 | return null; | ||
278 | 289 | ||
279 | if (asset != null) | 290 | if (asset != null) |
280 | return asset.Data; | 291 | return asset.Data; |
@@ -292,7 +303,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset | |||
292 | AssetBase asset = null; | 303 | AssetBase asset = null; |
293 | 304 | ||
294 | if (m_Cache != null) | 305 | if (m_Cache != null) |
295 | asset = m_Cache.Get(id); | 306 | { |
307 | bool negative; | ||
308 | asset = m_Cache.Get(id, out negative); | ||
309 | |||
310 | if (negative) | ||
311 | return false; | ||
312 | } | ||
296 | 313 | ||
297 | if (asset != null) | 314 | if (asset != null) |
298 | { | 315 | { |
@@ -381,8 +398,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset | |||
381 | { | 398 | { |
382 | AssetBase asset = null; | 399 | AssetBase asset = null; |
383 | 400 | ||
401 | bool negative; | ||
384 | if (m_Cache != null) | 402 | if (m_Cache != null) |
385 | asset = m_Cache.Get(id); | 403 | asset = m_Cache.Get(id, out negative); |
386 | 404 | ||
387 | if (asset != null) | 405 | if (asset != null) |
388 | { | 406 | { |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs index 7190aa0..bbaed21 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs | |||
@@ -158,7 +158,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset | |||
158 | 158 | ||
159 | AssetBase asset = null; | 159 | AssetBase asset = null; |
160 | if (m_Cache != null) | 160 | if (m_Cache != null) |
161 | asset = m_Cache.Get(id); | 161 | { |
162 | bool negative; | ||
163 | asset = m_Cache.Get(id, out negative); | ||
164 | |||
165 | if (negative) | ||
166 | return null; | ||
167 | } | ||
162 | 168 | ||
163 | if (asset == null) | 169 | if (asset == null) |
164 | { | 170 | { |
@@ -178,7 +184,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset | |||
178 | // m_log.DebugFormat("[LOCAL ASSET SERVICES CONNECTOR]: Cache request for {0}", id); | 184 | // m_log.DebugFormat("[LOCAL ASSET SERVICES CONNECTOR]: Cache request for {0}", id); |
179 | 185 | ||
180 | if (m_Cache != null) | 186 | if (m_Cache != null) |
181 | return m_Cache.Get(id); | 187 | { |
188 | bool negative; | ||
189 | return m_Cache.Get(id, out negative); | ||
190 | } | ||
182 | 191 | ||
183 | return null; | 192 | return null; |
184 | } | 193 | } |
@@ -187,7 +196,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset | |||
187 | { | 196 | { |
188 | AssetBase asset = null; | 197 | AssetBase asset = null; |
189 | if (m_Cache != null) | 198 | if (m_Cache != null) |
190 | asset = m_Cache.Get(id); | 199 | { |
200 | bool negative; | ||
201 | asset = m_Cache.Get(id, out negative); | ||
202 | if (negative) | ||
203 | return null; | ||
204 | } | ||
191 | 205 | ||
192 | if (asset != null) | 206 | if (asset != null) |
193 | return asset.Metadata; | 207 | return asset.Metadata; |
@@ -210,7 +224,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset | |||
210 | AssetBase asset = null; | 224 | AssetBase asset = null; |
211 | 225 | ||
212 | if (m_Cache != null) | 226 | if (m_Cache != null) |
213 | asset = m_Cache.Get(id); | 227 | { |
228 | bool negative; | ||
229 | asset = m_Cache.Get(id, out negative); | ||
230 | if (negative) | ||
231 | return null; | ||
232 | } | ||
214 | 233 | ||
215 | if (asset != null) | 234 | if (asset != null) |
216 | return asset.Data; | 235 | return asset.Data; |
@@ -232,7 +251,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset | |||
232 | 251 | ||
233 | if (m_Cache != null) | 252 | if (m_Cache != null) |
234 | { | 253 | { |
235 | AssetBase asset = m_Cache.Get(id); | 254 | bool negative; |
255 | AssetBase asset = m_Cache.Get(id, out negative); | ||
256 | |||
257 | if (negative) | ||
258 | return false; | ||
236 | 259 | ||
237 | if (asset != null) | 260 | if (asset != null) |
238 | { | 261 | { |
@@ -286,8 +309,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset | |||
286 | public bool UpdateContent(string id, byte[] data) | 309 | public bool UpdateContent(string id, byte[] data) |
287 | { | 310 | { |
288 | AssetBase asset = null; | 311 | AssetBase asset = null; |
312 | bool negative; | ||
289 | if (m_Cache != null) | 313 | if (m_Cache != null) |
290 | m_Cache.Get(id); | 314 | m_Cache.Get(id, out negative); |
291 | if (asset != null) | 315 | if (asset != null) |
292 | { | 316 | { |
293 | asset.Data = data; | 317 | asset.Data = data; |
diff --git a/OpenSim/Region/OptionalModules/Materials/MaterialsModule.cs b/OpenSim/Region/OptionalModules/Materials/MaterialsModule.cs index 3d2de82..e8cb052 100644 --- a/OpenSim/Region/OptionalModules/Materials/MaterialsModule.cs +++ b/OpenSim/Region/OptionalModules/Materials/MaterialsModule.cs | |||
@@ -329,8 +329,7 @@ namespace OpenSim.Region.OptionalModules.Materials | |||
329 | AssetBase matAsset = m_scene.AssetService.Get(id.ToString()); | 329 | AssetBase matAsset = m_scene.AssetService.Get(id.ToString()); |
330 | if (matAsset == null || matAsset.Data == null || matAsset.Data.Length == 0 ) | 330 | if (matAsset == null || matAsset.Data == null || matAsset.Data.Length == 0 ) |
331 | { | 331 | { |
332 | if (id != UUID.Zero) | 332 | //m_log.WarnFormat("[Materials]: Prim \"{0}\" ({1}) contains unknown material ID {2}", part.Name, part.UUID, id); |
333 | m_log.WarnFormat("[Materials]: Prim \"{0}\" ({1}) contains unknown material ID {2}", part.Name, part.UUID, id); | ||
334 | return; | 333 | return; |
335 | } | 334 | } |
336 | 335 | ||
diff --git a/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs b/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs index 3fa8b54..9595e7b 100644 --- a/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs +++ b/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs | |||
@@ -243,8 +243,16 @@ namespace OpenSim.Services.Connectors | |||
243 | string uri = MapServer(id) + "/assets/" + id; | 243 | string uri = MapServer(id) + "/assets/" + id; |
244 | 244 | ||
245 | AssetBase asset = null; | 245 | AssetBase asset = null; |
246 | |||
246 | if (m_Cache != null) | 247 | if (m_Cache != null) |
247 | asset = m_Cache.Get(id); | 248 | { |
249 | bool negative; | ||
250 | |||
251 | asset = m_Cache.Get(id, out negative); | ||
252 | |||
253 | if (negative) | ||
254 | return null; | ||
255 | } | ||
248 | 256 | ||
249 | if (asset == null || asset.Data == null || asset.Data.Length == 0) | 257 | if (asset == null || asset.Data == null || asset.Data.Length == 0) |
250 | { | 258 | { |
@@ -275,8 +283,9 @@ namespace OpenSim.Services.Connectors | |||
275 | { | 283 | { |
276 | // m_log.DebugFormat("[ASSET SERVICE CONNECTOR]: Cache request for {0}", id); | 284 | // m_log.DebugFormat("[ASSET SERVICE CONNECTOR]: Cache request for {0}", id); |
277 | 285 | ||
286 | bool negative; | ||
278 | if (m_Cache != null) | 287 | if (m_Cache != null) |
279 | return m_Cache.Get(id); | 288 | return m_Cache.Get(id, out negative); |
280 | 289 | ||
281 | return null; | 290 | return null; |
282 | } | 291 | } |
@@ -285,7 +294,11 @@ namespace OpenSim.Services.Connectors | |||
285 | { | 294 | { |
286 | if (m_Cache != null) | 295 | if (m_Cache != null) |
287 | { | 296 | { |
288 | AssetBase fullAsset = m_Cache.Get(id); | 297 | bool negative; |
298 | AssetBase fullAsset = m_Cache.Get(id, out negative); | ||
299 | |||
300 | if (negative) | ||
301 | return null; | ||
289 | 302 | ||
290 | if (fullAsset != null) | 303 | if (fullAsset != null) |
291 | return fullAsset.Metadata; | 304 | return fullAsset.Metadata; |
@@ -301,7 +314,11 @@ namespace OpenSim.Services.Connectors | |||
301 | { | 314 | { |
302 | if (m_Cache != null) | 315 | if (m_Cache != null) |
303 | { | 316 | { |
304 | AssetBase fullAsset = m_Cache.Get(id); | 317 | bool negative; |
318 | AssetBase fullAsset = m_Cache.Get(id, out negative); | ||
319 | |||
320 | if (negative) | ||
321 | return null; | ||
305 | 322 | ||
306 | if (fullAsset != null) | 323 | if (fullAsset != null) |
307 | return fullAsset.Data; | 324 | return fullAsset.Data; |
@@ -389,7 +406,14 @@ namespace OpenSim.Services.Connectors | |||
389 | 406 | ||
390 | AssetBase asset = null; | 407 | AssetBase asset = null; |
391 | if (m_Cache != null) | 408 | if (m_Cache != null) |
392 | asset = m_Cache.Get(id); | 409 | { |
410 | bool negative; | ||
411 | |||
412 | asset = m_Cache.Get(id, out negative); | ||
413 | |||
414 | if (negative) | ||
415 | return false; | ||
416 | } | ||
393 | 417 | ||
394 | if (asset == null || asset.Data == null || asset.Data.Length == 0) | 418 | if (asset == null || asset.Data == null || asset.Data.Length == 0) |
395 | { | 419 | { |
@@ -589,8 +613,9 @@ namespace OpenSim.Services.Connectors | |||
589 | { | 613 | { |
590 | AssetBase asset = null; | 614 | AssetBase asset = null; |
591 | 615 | ||
616 | bool negative; | ||
592 | if (m_Cache != null) | 617 | if (m_Cache != null) |
593 | asset = m_Cache.Get(id); | 618 | asset = m_Cache.Get(id, out negative); |
594 | 619 | ||
595 | if (asset == null) | 620 | if (asset == null) |
596 | { | 621 | { |
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs index 121e863..af5f69a 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs | |||
@@ -136,7 +136,10 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
136 | // Cache fetch | 136 | // Cache fetch |
137 | if (m_cache != null) | 137 | if (m_cache != null) |
138 | { | 138 | { |
139 | AssetBase asset = m_cache.Get(id); | 139 | bool negative; |
140 | AssetBase asset = m_cache.Get(id, out negative); | ||
141 | if (negative) | ||
142 | return null; | ||
140 | if (asset != null) | 143 | if (asset != null) |
141 | return asset; | 144 | return asset; |
142 | } | 145 | } |
@@ -147,8 +150,9 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
147 | 150 | ||
148 | public AssetBase GetCached(string id) | 151 | public AssetBase GetCached(string id) |
149 | { | 152 | { |
153 | bool negative; | ||
150 | if (m_cache != null) | 154 | if (m_cache != null) |
151 | return m_cache.Get(id); | 155 | return m_cache.Get(id, out negative); |
152 | 156 | ||
153 | return null; | 157 | return null; |
154 | } | 158 | } |
@@ -169,7 +173,10 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
169 | // Cache fetch | 173 | // Cache fetch |
170 | if (m_cache != null) | 174 | if (m_cache != null) |
171 | { | 175 | { |
172 | AssetBase asset = m_cache.Get(id); | 176 | bool negative; |
177 | AssetBase asset = m_cache.Get(id, out negative); | ||
178 | if (negative) | ||
179 | return null; | ||
173 | if (asset != null) | 180 | if (asset != null) |
174 | return asset.Metadata; | 181 | return asset.Metadata; |
175 | } | 182 | } |
@@ -212,7 +219,12 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
212 | // Cache fetch | 219 | // Cache fetch |
213 | if (m_cache != null) | 220 | if (m_cache != null) |
214 | { | 221 | { |
215 | AssetBase asset = m_cache.Get(id); | 222 | bool negative; |
223 | AssetBase asset = m_cache.Get(id, out negative); | ||
224 | |||
225 | if (negative) | ||
226 | return false; | ||
227 | |||
216 | if (asset != null) | 228 | if (asset != null) |
217 | { | 229 | { |
218 | handler(id, sender, asset); | 230 | handler(id, sender, asset); |