Letting the Flotsam cache be enabled even when [AssetCache] section is missing. Thank you mcortez!

0.6.6-post-fixes
diva 2009-06-09 20:20:30 +00:00
parent a7fcacf8f3
commit ca52c3ef26
1 changed files with 9 additions and 8 deletions

View File

@ -161,17 +161,17 @@ namespace Flotsam.RegionModules.AssetCache
if (name == Name) if (name == Name)
{ {
m_Enabled = true;
m_log.InfoFormat("[ASSET CACHE]: {0} enabled", this.Name);
IConfig assetConfig = source.Configs["AssetCache"]; IConfig assetConfig = source.Configs["AssetCache"];
if (assetConfig == null) if (assetConfig == null)
{ {
m_log.Error("[ASSET CACHE]: AssetCache missing from OpenSim.ini"); m_log.Warn("[ASSET CACHE]: AssetCache missing from OpenSim.ini, using defaults.");
m_log.InfoFormat("[ASSET CACHE]: Cache Directory", m_DefaultCacheDirectory);
return; return;
} }
m_Enabled = true;
m_log.InfoFormat("[ASSET CACHE]: {0} enabled", this.Name);
m_CacheDirectory = assetConfig.GetString("CacheDirectory", m_DefaultCacheDirectory); m_CacheDirectory = assetConfig.GetString("CacheDirectory", m_DefaultCacheDirectory);
m_log.InfoFormat("[ASSET CACHE]: Cache Directory", m_DefaultCacheDirectory); m_log.InfoFormat("[ASSET CACHE]: Cache Directory", m_DefaultCacheDirectory);
@ -182,6 +182,7 @@ namespace Flotsam.RegionModules.AssetCache
m_WaitOnInprogressTimeout = assetConfig.GetInt("WaitOnInprogressTimeout", 3000); m_WaitOnInprogressTimeout = assetConfig.GetInt("WaitOnInprogressTimeout", 3000);
#endif #endif
m_LogLevel = assetConfig.GetInt("LogLevel", 1);
m_HitRateDisplay = (ulong)assetConfig.GetInt("HitRateDisplay", 1); m_HitRateDisplay = (ulong)assetConfig.GetInt("HitRateDisplay", 1);
m_FileExpiration = TimeSpan.FromHours(assetConfig.GetDouble("FileCacheTimeout", m_DefaultFileExpiration)); m_FileExpiration = TimeSpan.FromHours(assetConfig.GetDouble("FileCacheTimeout", m_DefaultFileExpiration));
@ -230,7 +231,7 @@ namespace Flotsam.RegionModules.AssetCache
private void UpdateMemoryCache(string key, AssetBase asset) private void UpdateMemoryCache(string key, AssetBase asset)
{ {
if (m_MemoryCacheEnabled) if( m_MemoryCacheEnabled )
{ {
if (m_MemoryExpiration > TimeSpan.Zero) if (m_MemoryExpiration > TimeSpan.Zero)
{ {
@ -404,7 +405,7 @@ namespace Flotsam.RegionModules.AssetCache
File.Delete(filename); File.Delete(filename);
} }
if (m_MemoryCacheEnabled) if( m_MemoryCacheEnabled )
m_MemoryCache.Remove(id); m_MemoryCache.Remove(id);
} }
catch (Exception e) catch (Exception e)
@ -423,7 +424,7 @@ namespace Flotsam.RegionModules.AssetCache
Directory.Delete(dir); Directory.Delete(dir);
} }
if (m_MemoryCacheEnabled) if( m_MemoryCacheEnabled )
m_MemoryCache.Clear(); m_MemoryCache.Clear();
} }