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. --- .../Connectors/Asset/AssetServicesConnector.cs | 37 ++++++++++++++++++---- 1 file changed, 31 insertions(+), 6 deletions(-) (limited to 'OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs') 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 string uri = MapServer(id) + "/assets/" + id; AssetBase asset = null; + if (m_Cache != null) - asset = m_Cache.Get(id); + { + bool negative; + + asset = m_Cache.Get(id, out negative); + + if (negative) + return null; + } if (asset == null || asset.Data == null || asset.Data.Length == 0) { @@ -275,8 +283,9 @@ namespace OpenSim.Services.Connectors { // m_log.DebugFormat("[ASSET SERVICE CONNECTOR]: Cache request for {0}", id); + bool negative; if (m_Cache != null) - return m_Cache.Get(id); + return m_Cache.Get(id, out negative); return null; } @@ -285,7 +294,11 @@ namespace OpenSim.Services.Connectors { if (m_Cache != null) { - AssetBase fullAsset = m_Cache.Get(id); + bool negative; + AssetBase fullAsset = m_Cache.Get(id, out negative); + + if (negative) + return null; if (fullAsset != null) return fullAsset.Metadata; @@ -301,7 +314,11 @@ namespace OpenSim.Services.Connectors { if (m_Cache != null) { - AssetBase fullAsset = m_Cache.Get(id); + bool negative; + AssetBase fullAsset = m_Cache.Get(id, out negative); + + if (negative) + return null; if (fullAsset != null) return fullAsset.Data; @@ -389,7 +406,14 @@ namespace OpenSim.Services.Connectors AssetBase asset = null; if (m_Cache != null) - asset = m_Cache.Get(id); + { + bool negative; + + asset = m_Cache.Get(id, out negative); + + if (negative) + return false; + } if (asset == null || asset.Data == null || asset.Data.Length == 0) { @@ -589,8 +613,9 @@ namespace OpenSim.Services.Connectors { AssetBase asset = null; + bool negative; if (m_Cache != null) - asset = m_Cache.Get(id); + asset = m_Cache.Get(id, out negative); if (asset == null) { -- cgit v1.1