diff --git a/OpenSim/Framework/IAssetCache.cs b/OpenSim/Framework/IAssetCache.cs
index 1e6d19d529..2df9199a26 100644
--- a/OpenSim/Framework/IAssetCache.cs
+++ b/OpenSim/Framework/IAssetCache.cs
@@ -47,8 +47,9 @@ namespace OpenSim.Framework
/// Get an asset by its id.
///
///
- /// null if the asset does not exist.
- AssetBase Get(string id, out bool negative);
+ /// Will be set to null if no asset was found
+ /// False if the asset has been negative-cached
+ bool Get(string id, out AssetBase asset);
///
/// 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 f181c3943b..427e149f69 100644
--- a/OpenSim/Framework/WearableCacheItem.cs
+++ b/OpenSim/Framework/WearableCacheItem.cs
@@ -113,8 +113,8 @@ namespace OpenSim.Framework
{
if (dataCache.Check(item.TextureID.ToString()))
{
- bool negative;
- AssetBase assetItem = dataCache.Get(item.TextureID.ToString(), out negative);
+ AssetBase assetItem;
+ dataCache.Get(item.TextureID.ToString(), out assetItem);
if (assetItem != null)
{
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 594b6bbecc..6e4a710bf9 100644
--- a/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs
+++ b/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs
@@ -369,8 +369,8 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender
else if (Cache != null)
{
string assetName = "j2kCache_" + AssetId.ToString();
- bool negative;
- AssetBase layerDecodeAsset = Cache.Get(assetName, out negative);
+ AssetBase layerDecodeAsset;
+ Cache.Get(assetName, out layerDecodeAsset);
if (layerDecodeAsset != null)
{
diff --git a/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs b/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs
index 136134fc03..403236c170 100644
--- a/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs
+++ b/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs
@@ -260,12 +260,9 @@ namespace OpenSim.Region.CoreModules.Asset
/// Cache doesn't guarantee in any situation that asset is stored to it.
///
///
- public AssetBase Get(string id, out bool negative)
+ public bool Get(string id, out AssetBase assetBase)
{
- negative = false;
-
m_getCount++;
- AssetBase assetBase;
if (m_cache.TryGetValue(id, out assetBase))
m_hitCount++;
@@ -286,7 +283,7 @@ namespace OpenSim.Region.CoreModules.Asset
// if (null == assetBase)
// m_log.DebugFormat("[CENOME ASSET CACHE]: Asset {0} not in cache", id);
- return assetBase;
+ return true;
}
#endregion
diff --git a/OpenSim/Region/CoreModules/Asset/CoreAssetCache.cs b/OpenSim/Region/CoreModules/Asset/CoreAssetCache.cs
index d655509cc7..10c0e85175 100644
--- a/OpenSim/Region/CoreModules/Asset/CoreAssetCache.cs
+++ b/OpenSim/Region/CoreModules/Asset/CoreAssetCache.cs
@@ -115,8 +115,10 @@ namespace OpenSim.Region.CoreModules.Asset
public bool Check(string id)
{
// XXX This is probably not an efficient implementation.
- bool negative;
- return Get(id, out negative) != null;
+ AssetBase asset;
+ if (!Get(id, out asset))
+ return false;
+ return asset != null;
}
public void Cache(AssetBase asset)
@@ -130,10 +132,10 @@ namespace OpenSim.Region.CoreModules.Asset
// We don't do negative caching
}
- public AssetBase Get(string id, out bool negative)
+ public bool Get(string id, out AssetBase asset)
{
- negative = false;
- return (AssetBase)m_Cache.Get(id);
+ asset = (AssetBase)m_Cache.Get(id);
+ return true;
}
public void Expire(string id)
diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
index b183a75216..f8a4461226 100644
--- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
+++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
@@ -536,24 +536,23 @@ namespace OpenSim.Region.CoreModules.Asset
// For IAssetService
public AssetBase Get(string id)
{
- bool negative;
- return Get(id, out negative);
+ AssetBase asset;
+ Get(id, out asset);
+ return asset;
}
- public AssetBase Get(string id, out bool negative)
+ public bool Get(string id, out AssetBase asset)
{
- negative = false;
+ asset = null;
m_Requests++;
object dummy;
if (m_negativeCache.TryGetValue(id, out dummy))
{
- negative = true;
- return null;
+ return false;
}
- AssetBase asset = null;
asset = GetFromWeakReference(id);
if (asset != null && m_updateFileTimeOnCacheHit)
{
@@ -592,7 +591,7 @@ namespace OpenSim.Region.CoreModules.Asset
GenerateCacheHitReport().ForEach(l => m_log.InfoFormat("[FLOTSAM ASSET CACHE]: {0}", l));
}
- return asset;
+ return true;
}
public bool Check(string id)
@@ -607,8 +606,9 @@ namespace OpenSim.Region.CoreModules.Asset
public AssetBase GetCached(string id)
{
- bool negative;
- return Get(id, out negative);
+ AssetBase asset;
+ Get(id, out asset);
+ return asset;
}
public void Expire(string id)
@@ -1236,23 +1236,22 @@ namespace OpenSim.Region.CoreModules.Asset
public AssetMetadata GetMetadata(string id)
{
- bool negative;
- AssetBase asset = Get(id, out negative);
+ AssetBase asset;
+ Get(id, out asset);
return asset.Metadata;
}
public byte[] GetData(string id)
{
- bool negative;
- AssetBase asset = Get(id, out negative);
+ AssetBase asset;
+ Get(id, out asset);
return asset.Data;
}
public bool Get(string id, object sender, AssetRetrieved handler)
{
- bool negative;
- AssetBase asset = Get(id, out negative);
- if (negative)
+ AssetBase asset;
+ if (!Get(id, out asset))
return false;
handler(id, sender, asset);
return true;
@@ -1284,8 +1283,9 @@ namespace OpenSim.Region.CoreModules.Asset
public bool UpdateContent(string id, byte[] data)
{
- bool negative;
- AssetBase asset = Get(id, out negative);
+ AssetBase asset;
+ if (!Get(id, out asset))
+ return false;
asset.Data = data;
Cache(asset);
return true;
diff --git a/OpenSim/Region/CoreModules/Asset/GlynnTuckerAssetCache.cs b/OpenSim/Region/CoreModules/Asset/GlynnTuckerAssetCache.cs
index 342d4d9e99..abe9b23770 100644
--- a/OpenSim/Region/CoreModules/Asset/GlynnTuckerAssetCache.cs
+++ b/OpenSim/Region/CoreModules/Asset/GlynnTuckerAssetCache.cs
@@ -131,16 +131,15 @@ namespace OpenSim.Region.CoreModules.Asset
// We don't do negative caching
}
- public AssetBase Get(string id, out bool negative)
+ public bool Get(string id, out AssetBase asset)
{
- negative = false;
+ Object a = null;
+ m_Cache.TryGet(id, out a);
- Object asset = null;
- m_Cache.TryGet(id, out asset);
+ Debug(a);
- Debug(asset);
-
- return (AssetBase)asset;
+ asset = (AssetBase)a;
+ return true;
}
public void Expire(string id)
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
index 3e47782321..535d946710 100644
--- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
@@ -299,8 +299,8 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
if (bakedTextureFace == null)
continue;
- bool negative;
- AssetBase asset = cache.Get(bakedTextureFace.TextureID.ToString(), out negative);
+ AssetBase asset;
+ cache.Get(bakedTextureFace.TextureID.ToString(), out asset);
if (asset != null && asset.Local)
{
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs
index ce61ff0b4b..bf9327c09d 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs
@@ -209,10 +209,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
if (m_Cache != null)
{
- bool negative;
- asset = m_Cache.Get(id, out negative);
-
- if (negative)
+ if (!m_Cache.Get(id, out asset))
return null;
if (asset != null)
@@ -242,9 +239,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
public AssetBase GetCached(string id)
{
- bool negative;
+ AssetBase asset = null;
if (m_Cache != null)
- return m_Cache.Get(id, out negative);
+ m_Cache.Get(id, out asset);
return null;
}
@@ -255,10 +252,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
if (m_Cache != null)
{
- bool negative;
- asset = m_Cache.Get(id, out negative);
-
- if (negative)
+ if (!m_Cache.Get(id, out asset))
return null;
if (asset != null)
@@ -281,10 +275,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
if (m_Cache != null)
{
- bool negative;
- asset = m_Cache.Get(id, out negative);
-
- if (negative)
+ if (!m_Cache.Get(id, out asset))
return null;
if (asset != null)
@@ -304,10 +295,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
if (m_Cache != null)
{
- bool negative;
- asset = m_Cache.Get(id, out negative);
-
- if (negative)
+ if (!m_Cache.Get(id, out asset))
return false;
}
@@ -398,9 +386,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
{
AssetBase asset = null;
- bool negative;
if (m_Cache != null)
- asset = m_Cache.Get(id, out negative);
+ m_Cache.Get(id, out asset);
if (asset != null)
{
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs
index bbaed21d31..2fe97335b6 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs
@@ -159,10 +159,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
AssetBase asset = null;
if (m_Cache != null)
{
- bool negative;
- asset = m_Cache.Get(id, out negative);
-
- if (negative)
+ if (!m_Cache.Get(id, out asset))
return null;
}
@@ -183,13 +180,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
{
// m_log.DebugFormat("[LOCAL ASSET SERVICES CONNECTOR]: Cache request for {0}", id);
+ AssetBase asset = null;
if (m_Cache != null)
- {
- bool negative;
- return m_Cache.Get(id, out negative);
- }
+ m_Cache.Get(id, out asset);
- return null;
+ return asset;
}
public AssetMetadata GetMetadata(string id)
@@ -197,9 +192,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
AssetBase asset = null;
if (m_Cache != null)
{
- bool negative;
- asset = m_Cache.Get(id, out negative);
- if (negative)
+ if (!m_Cache.Get(id, out asset))
return null;
}
diff --git a/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs b/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs
index 9595e7bc18..810da2f7cc 100644
--- a/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs
+++ b/OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs
@@ -246,11 +246,7 @@ namespace OpenSim.Services.Connectors
if (m_Cache != null)
{
- bool negative;
-
- asset = m_Cache.Get(id, out negative);
-
- if (negative)
+ if (!m_Cache.Get(id, out asset))
return null;
}
@@ -283,21 +279,21 @@ namespace OpenSim.Services.Connectors
{
// m_log.DebugFormat("[ASSET SERVICE CONNECTOR]: Cache request for {0}", id);
- bool negative;
+ AssetBase asset = null;
if (m_Cache != null)
- return m_Cache.Get(id, out negative);
+ {
+ m_Cache.Get(id, out asset);
+ }
- return null;
+ return asset;
}
public AssetMetadata GetMetadata(string id)
{
if (m_Cache != null)
{
- bool negative;
- AssetBase fullAsset = m_Cache.Get(id, out negative);
-
- if (negative)
+ AssetBase fullAsset;
+ if (!m_Cache.Get(id, out fullAsset))
return null;
if (fullAsset != null)
@@ -314,10 +310,8 @@ namespace OpenSim.Services.Connectors
{
if (m_Cache != null)
{
- bool negative;
- AssetBase fullAsset = m_Cache.Get(id, out negative);
-
- if (negative)
+ AssetBase fullAsset;
+ if (!m_Cache.Get(id, out fullAsset))
return null;
if (fullAsset != null)
@@ -407,11 +401,7 @@ namespace OpenSim.Services.Connectors
AssetBase asset = null;
if (m_Cache != null)
{
- bool negative;
-
- asset = m_Cache.Get(id, out negative);
-
- if (negative)
+ if (!m_Cache.Get(id, out asset))
return false;
}
@@ -613,9 +603,8 @@ namespace OpenSim.Services.Connectors
{
AssetBase asset = null;
- bool negative;
if (m_Cache != null)
- asset = m_Cache.Get(id, out negative);
+ m_Cache.Get(id, out asset);
if (asset == null)
{
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs
index af5f69aa0e..953bc2af1b 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)