aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
diff options
context:
space:
mode:
authorMelanie2011-02-27 19:47:37 +0000
committerMelanie2011-02-27 19:47:37 +0000
commit9b277b372be4e1071c02f87a53cb70a4324d77fa (patch)
tree35183674cbacc79f2931a9cc11f747974fff845b /OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
parentFix a few little things (diff)
parentchange some log messages from info to debug (diff)
downloadopensim-SC_OLD-9b277b372be4e1071c02f87a53cb70a4324d77fa.zip
opensim-SC_OLD-9b277b372be4e1071c02f87a53cb70a4324d77fa.tar.gz
opensim-SC_OLD-9b277b372be4e1071c02f87a53cb70a4324d77fa.tar.bz2
opensim-SC_OLD-9b277b372be4e1071c02f87a53cb70a4324d77fa.tar.xz
Merge branch 'master' into careminster-presence-refactor
Diffstat (limited to 'OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs')
-rw-r--r--OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs21
1 files changed, 6 insertions, 15 deletions
diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
index e542d7d..7cba702 100644
--- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
+++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
@@ -92,9 +92,9 @@ namespace Flotsam.RegionModules.AssetCache
92 // Expiration is expressed in hours. 92 // Expiration is expressed in hours.
93 private const double m_DefaultMemoryExpiration = 1.0; 93 private const double m_DefaultMemoryExpiration = 1.0;
94 private const double m_DefaultFileExpiration = 48; 94 private const double m_DefaultFileExpiration = 48;
95 private TimeSpan m_MemoryExpiration = TimeSpan.Zero; 95 private TimeSpan m_MemoryExpiration = TimeSpan.FromHours(m_DefaultMemoryExpiration);
96 private TimeSpan m_FileExpiration = TimeSpan.Zero; 96 private TimeSpan m_FileExpiration = TimeSpan.FromHours(m_DefaultFileExpiration);
97 private TimeSpan m_FileExpirationCleanupTimer = TimeSpan.Zero; 97 private TimeSpan m_FileExpirationCleanupTimer = TimeSpan.FromHours(m_DefaultFileExpiration);
98 98
99 private static int m_CacheDirectoryTiers = 1; 99 private static int m_CacheDirectoryTiers = 1;
100 private static int m_CacheDirectoryTierLen = 3; 100 private static int m_CacheDirectoryTierLen = 3;
@@ -147,7 +147,7 @@ namespace Flotsam.RegionModules.AssetCache
147 } 147 }
148 148
149 m_CacheDirectory = assetConfig.GetString("CacheDirectory", m_DefaultCacheDirectory); 149 m_CacheDirectory = assetConfig.GetString("CacheDirectory", m_DefaultCacheDirectory);
150 m_log.InfoFormat("[FLOTSAM ASSET CACHE]: Cache Directory", m_DefaultCacheDirectory); 150 m_log.InfoFormat("[FLOTSAM ASSET CACHE]: Cache Directory", m_CacheDirectory);
151 151
152 m_MemoryCacheEnabled = assetConfig.GetBoolean("MemoryCacheEnabled", false); 152 m_MemoryCacheEnabled = assetConfig.GetBoolean("MemoryCacheEnabled", false);
153 m_MemoryExpiration = TimeSpan.FromHours(assetConfig.GetDouble("MemoryCacheTimeout", m_DefaultMemoryExpiration)); 153 m_MemoryExpiration = TimeSpan.FromHours(assetConfig.GetDouble("MemoryCacheTimeout", m_DefaultMemoryExpiration));
@@ -245,16 +245,7 @@ namespace Flotsam.RegionModules.AssetCache
245 private void UpdateMemoryCache(string key, AssetBase asset) 245 private void UpdateMemoryCache(string key, AssetBase asset)
246 { 246 {
247 if (m_MemoryCacheEnabled) 247 if (m_MemoryCacheEnabled)
248 { 248 m_MemoryCache.AddOrUpdate(key, asset, m_MemoryExpiration);
249 if (m_MemoryExpiration > TimeSpan.Zero)
250 {
251 m_MemoryCache.AddOrUpdate(key, asset, m_MemoryExpiration);
252 }
253 else
254 {
255 m_MemoryCache.AddOrUpdate(key, asset, Double.MaxValue);
256 }
257 }
258 } 249 }
259 250
260 public void Cache(AssetBase asset) 251 public void Cache(AssetBase asset)
@@ -459,7 +450,7 @@ namespace Flotsam.RegionModules.AssetCache
459 private void CleanupExpiredFiles(object source, ElapsedEventArgs e) 450 private void CleanupExpiredFiles(object source, ElapsedEventArgs e)
460 { 451 {
461 if (m_LogLevel >= 2) 452 if (m_LogLevel >= 2)
462 m_log.DebugFormat("[FLOTSAM ASSET CACHE]: Checking for expired files older then {0}.", m_FileExpiration.ToString()); 453 m_log.DebugFormat("[FLOTSAM ASSET CACHE]: Checking for expired files older then {0}.", m_FileExpiration);
463 454
464 // Purge all files last accessed prior to this point 455 // Purge all files last accessed prior to this point
465 DateTime purgeLine = DateTime.Now - m_FileExpiration; 456 DateTime purgeLine = DateTime.Now - m_FileExpiration;