summaryrefslogtreecommitdiff
path: root/indra/newview/llappviewer.cpp
diff options
context:
space:
mode:
authorCallum Prentice <callum@gmail.com>2020-10-27 13:53:17 -0700
committerCallum Prentice <callum@gmail.com>2020-10-27 13:53:17 -0700
commit391ada1150a861e899dcde8558e9efd4c5efc981 (patch)
tree78e958a9f7e389f9c375bd4fbaf6456eba4973d7 /indra/newview/llappviewer.cpp
parent581cb0a0e9c3191295e8ff5bfa836b40fd85f0b8 (diff)
Fix for meta issue: SL-14211 Determine optimum cache size for VFS replacement cache
Diffstat (limited to 'indra/newview/llappviewer.cpp')
-rw-r--r--indra/newview/llappviewer.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index 9e50860064..20ca432279 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -4063,10 +4063,16 @@ bool LLAppViewer::initCache()
// initialize the new disk cache using saved settings
const std::string cache_dir_name = gSavedSettings.getString("DiskCacheDirName");
- const unsigned int cache_max_bytes = gSavedSettings.getU32("DiskCacheMaxSizeMB") * 1024 * 1024;
+
+ // note that the maximum size of this cache is defined as a percentage of the
+ // total cache size - the 'CacheSize' pref - for all caches.
+ const unsigned int cache_total_size_mb = gSavedSettings.getU32("CacheSize");
+ const double disk_cache_percent = gSavedSettings.getF32("DiskCachePercentOfTotal");
+ const unsigned int disk_cache_mb = cache_total_size_mb * disk_cache_percent / 100;
+ const unsigned int disk_cache_bytes = disk_cache_mb * 1024 * 1024;
const bool enable_cache_debug_info = gSavedSettings.getBOOL("EnableDiskCacheDebugInfo");
const std::string cache_dir = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, cache_dir_name);
- LLDiskCache::initParamSingleton(cache_dir, cache_max_bytes, enable_cache_debug_info);
+ LLDiskCache::initParamSingleton(cache_dir, disk_cache_bytes, enable_cache_debug_info);
bool texture_cache_mismatch = false;
if (gSavedSettings.getS32("LocalCacheVersion") != LLAppViewer::getTextureCacheVersion())