From 5a18ea31cf9d9a97fc1a65f8623b633c244221c2 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Mon, 30 Jan 2017 13:59:05 +0000 Subject: 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. --- .../SimianGrid/SimianAssetServiceConnector.cs | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs') 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 // Cache fetch if (m_cache != null) { - AssetBase asset = m_cache.Get(id); + bool negative; + AssetBase asset = m_cache.Get(id, out negative); + if (negative) + return null; if (asset != null) return asset; } @@ -147,8 +150,9 @@ namespace OpenSim.Services.Connectors.SimianGrid public AssetBase GetCached(string id) { + bool negative; if (m_cache != null) - return m_cache.Get(id); + return m_cache.Get(id, out negative); return null; } @@ -169,7 +173,10 @@ namespace OpenSim.Services.Connectors.SimianGrid // Cache fetch if (m_cache != null) { - AssetBase asset = m_cache.Get(id); + bool negative; + AssetBase asset = m_cache.Get(id, out negative); + if (negative) + return null; if (asset != null) return asset.Metadata; } @@ -212,7 +219,12 @@ namespace OpenSim.Services.Connectors.SimianGrid // Cache fetch if (m_cache != null) { - AssetBase asset = m_cache.Get(id); + bool negative; + AssetBase asset = m_cache.Get(id, out negative); + + if (negative) + return false; + if (asset != null) { handler(id, sender, asset); -- cgit v1.1 From a5151bb337cfee14dff6045d7f8e293201ae94ac Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Wed, 1 Feb 2017 16:31:01 +0000 Subject: Refactor asset handling as per Ubit's suggestion --- .../SimianGrid/SimianAssetServiceConnector.cs | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs') diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs index af5f69a..953bc2a 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs @@ -136,9 +136,8 @@ namespace OpenSim.Services.Connectors.SimianGrid // Cache fetch if (m_cache != null) { - bool negative; - AssetBase asset = m_cache.Get(id, out negative); - if (negative) + AssetBase asset; + if (!m_cache.Get(id, out asset)) return null; if (asset != null) return asset; @@ -150,9 +149,9 @@ namespace OpenSim.Services.Connectors.SimianGrid public AssetBase GetCached(string id) { - bool negative; + AssetBase asset; if (m_cache != null) - return m_cache.Get(id, out negative); + m_cache.Get(id, out asset); return null; } @@ -173,9 +172,8 @@ namespace OpenSim.Services.Connectors.SimianGrid // Cache fetch if (m_cache != null) { - bool negative; - AssetBase asset = m_cache.Get(id, out negative); - if (negative) + AssetBase asset; + if (!m_cache.Get(id, out asset)) return null; if (asset != null) return asset.Metadata; @@ -219,10 +217,8 @@ namespace OpenSim.Services.Connectors.SimianGrid // Cache fetch if (m_cache != null) { - bool negative; - AssetBase asset = m_cache.Get(id, out negative); - - if (negative) + AssetBase asset; + if (!m_cache.Get(id, out asset)) return false; if (asset != null) -- cgit v1.1