diff options
author | Melanie | 2010-02-15 00:20:48 +0000 |
---|---|---|
committer | Melanie | 2010-02-15 00:20:48 +0000 |
commit | c033223c63274ebe41075b24d108ca952fbd242c (patch) | |
tree | 8c969a9643c469feb37133b175be18eb52fdff49 /OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs | |
parent | Extraneous debug messages removed (diff) | |
parent | Plug a small hole (diff) | |
download | opensim-SC_OLD-c033223c63274ebe41075b24d108ca952fbd242c.zip opensim-SC_OLD-c033223c63274ebe41075b24d108ca952fbd242c.tar.gz opensim-SC_OLD-c033223c63274ebe41075b24d108ca952fbd242c.tar.bz2 opensim-SC_OLD-c033223c63274ebe41075b24d108ca952fbd242c.tar.xz |
Merge branch 'master' into presence-refactor
Diffstat (limited to 'OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs b/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs index 1add0ab..1903eb9 100644 --- a/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs +++ b/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs | |||
@@ -91,6 +91,8 @@ namespace OpenSim.Region.CoreModules.Asset | |||
91 | /// </example> | 91 | /// </example> |
92 | public class CenomeMemoryAssetCache : IImprovedAssetCache, ISharedRegionModule | 92 | public class CenomeMemoryAssetCache : IImprovedAssetCache, ISharedRegionModule |
93 | { | 93 | { |
94 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
95 | |||
94 | /// <summary> | 96 | /// <summary> |
95 | /// Cache's default maximal asset count. | 97 | /// Cache's default maximal asset count. |
96 | /// </summary> | 98 | /// </summary> |
@@ -115,12 +117,7 @@ namespace OpenSim.Region.CoreModules.Asset | |||
115 | /// Asset's default expiration time in the cache. | 117 | /// Asset's default expiration time in the cache. |
116 | /// </summary> | 118 | /// </summary> |
117 | public static readonly TimeSpan DefaultExpirationTime = TimeSpan.FromMinutes(30.0); | 119 | public static readonly TimeSpan DefaultExpirationTime = TimeSpan.FromMinutes(30.0); |
118 | 120 | ||
119 | /// <summary> | ||
120 | /// Log manager instance. | ||
121 | /// </summary> | ||
122 | private static readonly ILog Log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
123 | |||
124 | /// <summary> | 121 | /// <summary> |
125 | /// Cache object. | 122 | /// Cache object. |
126 | /// </summary> | 123 | /// </summary> |
@@ -170,7 +167,7 @@ namespace OpenSim.Region.CoreModules.Asset | |||
170 | { | 167 | { |
171 | if (maximalSize <= 0 || maximalCount <= 0) | 168 | if (maximalSize <= 0 || maximalCount <= 0) |
172 | { | 169 | { |
173 | //Log.Debug("[ASSET CACHE]: Cenome asset cache is not enabled."); | 170 | //m_log.Debug("[ASSET CACHE]: Cenome asset cache is not enabled."); |
174 | m_enabled = false; | 171 | m_enabled = false; |
175 | return; | 172 | return; |
176 | } | 173 | } |
@@ -186,7 +183,7 @@ namespace OpenSim.Region.CoreModules.Asset | |||
186 | CnmSynchronizedCache<string, AssetBase>.Synchronized(new CnmMemoryCache<string, AssetBase>( | 183 | CnmSynchronizedCache<string, AssetBase>.Synchronized(new CnmMemoryCache<string, AssetBase>( |
187 | maximalSize, maximalCount, expirationTime)); | 184 | maximalSize, maximalCount, expirationTime)); |
188 | m_enabled = true; | 185 | m_enabled = true; |
189 | Log.DebugFormat( | 186 | m_log.DebugFormat( |
190 | "[ASSET CACHE]: Cenome asset cache enabled (MaxSize = {0} bytes, MaxCount = {1}, ExpirationTime = {2})", | 187 | "[ASSET CACHE]: Cenome asset cache enabled (MaxSize = {0} bytes, MaxCount = {1}, ExpirationTime = {2})", |
191 | maximalSize, | 188 | maximalSize, |
192 | maximalCount, | 189 | maximalCount, |
@@ -205,6 +202,8 @@ namespace OpenSim.Region.CoreModules.Asset | |||
205 | { | 202 | { |
206 | if (asset != null) | 203 | if (asset != null) |
207 | { | 204 | { |
205 | // m_log.DebugFormat("[CENOME ASSET CACHE]: Caching asset {0}", asset.ID); | ||
206 | |||
208 | long size = asset.Data != null ? asset.Data.Length : 1; | 207 | long size = asset.Data != null ? asset.Data.Length : 1; |
209 | m_cache.Set(asset.ID, asset, size); | 208 | m_cache.Set(asset.ID, asset, size); |
210 | m_cachedCount++; | 209 | m_cachedCount++; |
@@ -255,7 +254,7 @@ namespace OpenSim.Region.CoreModules.Asset | |||
255 | 254 | ||
256 | if (m_getCount == m_debugEpoch) | 255 | if (m_getCount == m_debugEpoch) |
257 | { | 256 | { |
258 | Log.DebugFormat( | 257 | m_log.DebugFormat( |
259 | "[ASSET CACHE]: Cached = {0}, Get = {1}, Hits = {2}%, Size = {3} bytes, Avg. A. Size = {4} bytes", | 258 | "[ASSET CACHE]: Cached = {0}, Get = {1}, Hits = {2}%, Size = {3} bytes, Avg. A. Size = {4} bytes", |
260 | m_cachedCount, | 259 | m_cachedCount, |
261 | m_getCount, | 260 | m_getCount, |
@@ -267,6 +266,9 @@ namespace OpenSim.Region.CoreModules.Asset | |||
267 | m_cachedCount = 0; | 266 | m_cachedCount = 0; |
268 | } | 267 | } |
269 | 268 | ||
269 | // if (null == assetBase) | ||
270 | // m_log.DebugFormat("[CENOME ASSET CACHE]: Asset {0} not in cache", id); | ||
271 | |||
270 | return assetBase; | 272 | return assetBase; |
271 | } | 273 | } |
272 | 274 | ||
@@ -325,12 +327,11 @@ namespace OpenSim.Region.CoreModules.Asset | |||
325 | return; | 327 | return; |
326 | 328 | ||
327 | string name = moduleConfig.GetString("AssetCaching"); | 329 | string name = moduleConfig.GetString("AssetCaching"); |
328 | //Log.DebugFormat("[XXX] name = {0} (this module's name: {1}", name, Name); | 330 | //m_log.DebugFormat("[XXX] name = {0} (this module's name: {1}", name, Name); |
329 | 331 | ||
330 | if (name != Name) | 332 | if (name != Name) |
331 | return; | 333 | return; |
332 | 334 | ||
333 | // This module is used | ||
334 | long maxSize = DefaultMaxSize; | 335 | long maxSize = DefaultMaxSize; |
335 | int maxCount = DefaultMaxCount; | 336 | int maxCount = DefaultMaxCount; |
336 | TimeSpan expirationTime = DefaultExpirationTime; | 337 | TimeSpan expirationTime = DefaultExpirationTime; |