diff options
-rw-r--r-- | OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs index e7f4981..5400c91 100644 --- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs +++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs | |||
@@ -110,6 +110,7 @@ namespace OpenSim.Region.CoreModules.Asset | |||
110 | 110 | ||
111 | private Dictionary<string,WeakReference> weakAssetReferences = new Dictionary<string, WeakReference>(); | 111 | private Dictionary<string,WeakReference> weakAssetReferences = new Dictionary<string, WeakReference>(); |
112 | private object weakAssetReferencesLock = new object(); | 112 | private object weakAssetReferencesLock = new object(); |
113 | private bool m_updateFileTimeOnCacheHit = false; | ||
113 | 114 | ||
114 | public FlotsamAssetCache() | 115 | public FlotsamAssetCache() |
115 | { | 116 | { |
@@ -156,6 +157,8 @@ namespace OpenSim.Region.CoreModules.Asset | |||
156 | m_MemoryCacheEnabled = assetConfig.GetBoolean("MemoryCacheEnabled", m_MemoryCacheEnabled); | 157 | m_MemoryCacheEnabled = assetConfig.GetBoolean("MemoryCacheEnabled", m_MemoryCacheEnabled); |
157 | m_MemoryExpiration = assetConfig.GetDouble("MemoryCacheTimeout", m_MemoryExpiration); | 158 | m_MemoryExpiration = assetConfig.GetDouble("MemoryCacheTimeout", m_MemoryExpiration); |
158 | m_MemoryExpiration *= 3600.0; // config in hours to seconds | 159 | m_MemoryExpiration *= 3600.0; // config in hours to seconds |
160 | |||
161 | m_updateFileTimeOnCacheHit = assetConfig.GetBoolean("UpdateFileTimeOnCacheHit", m_updateFileTimeOnCacheHit); | ||
159 | 162 | ||
160 | #if WAIT_ON_INPROGRESS_REQUESTS | 163 | #if WAIT_ON_INPROGRESS_REQUESTS |
161 | m_WaitOnInprogressTimeout = assetConfig.GetInt("WaitOnInprogressTimeout", 3000); | 164 | m_WaitOnInprogressTimeout = assetConfig.GetInt("WaitOnInprogressTimeout", 3000); |
@@ -513,12 +516,24 @@ namespace OpenSim.Region.CoreModules.Asset | |||
513 | 516 | ||
514 | AssetBase asset = null; | 517 | AssetBase asset = null; |
515 | asset = GetFromWeakReference(id); | 518 | asset = GetFromWeakReference(id); |
519 | if (asset != null && m_updateFileTimeOnCacheHit) | ||
520 | { | ||
521 | string filename = GetFileName(id); | ||
522 | UpdateFileLastAccessTime(filename); | ||
523 | } | ||
516 | 524 | ||
517 | if (m_MemoryCacheEnabled && asset == null) | 525 | if (m_MemoryCacheEnabled && asset == null) |
518 | { | 526 | { |
519 | asset = GetFromMemoryCache(id); | 527 | asset = GetFromMemoryCache(id); |
520 | if(asset != null) | 528 | if(asset != null) |
529 | { | ||
521 | UpdateWeakReference(id,asset); | 530 | UpdateWeakReference(id,asset); |
531 | if (m_updateFileTimeOnCacheHit) | ||
532 | { | ||
533 | string filename = GetFileName(id); | ||
534 | UpdateFileLastAccessTime(filename); | ||
535 | } | ||
536 | } | ||
522 | } | 537 | } |
523 | 538 | ||
524 | if (asset == null && m_FileCacheEnabled) | 539 | if (asset == null && m_FileCacheEnabled) |