summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorMnikolenko Productengine <mnikolenko@productengine.com>2020-10-08 15:26:54 +0300
committerMnikolenko Productengine <mnikolenko@productengine.com>2020-10-08 15:26:54 +0300
commit3051db7b61ee43fffd28f0a12c0714b11b6b7df7 (patch)
tree763df757d2660cf5f124de8f1164136ab2203963 /indra/newview
parenta818c44ef21cf6b4e4eeab0ee0325a780898fccc (diff)
Purge excessive files from disc cache each startup
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llappviewer.cpp32
1 files changed, 20 insertions, 12 deletions
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index afafedf207..9e50860064 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -4061,6 +4061,13 @@ bool LLAppViewer::initCache()
LLAppViewer::getTextureCache()->setReadOnly(read_only) ;
LLVOCache::initParamSingleton(read_only);
+ // 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;
+ 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);
+
bool texture_cache_mismatch = false;
if (gSavedSettings.getS32("LocalCacheVersion") != LLAppViewer::getTextureCacheVersion())
{
@@ -4107,13 +4114,21 @@ bool LLAppViewer::initCache()
gSavedSettings.setString("CacheLocationTopFolder", "");
}
- if (mPurgeCache && !read_only)
+ if (!read_only)
{
- LLSplashScreen::update(LLTrans::getString("StartupClearingCache"));
- purgeCache();
+ if (mPurgeCache)
+ {
+ LLSplashScreen::update(LLTrans::getString("StartupClearingCache"));
+ purgeCache();
- // purge the new C++ file system based cache
- LLDiskCache::getInstance()->purge();
+ // clear the new C++ file system based cache
+ LLDiskCache::getInstance()->clearCache();
+ }
+ else
+ {
+ // purge excessive files from the new file system based cache
+ LLDiskCache::getInstance()->purge();
+ }
}
LLSplashScreen::update(LLTrans::getString("StartupInitializingTextureCache"));
@@ -4134,13 +4149,6 @@ bool LLAppViewer::initCache()
LLVOCache::getInstance()->initCache(LL_PATH_CACHE, gSavedSettings.getU32("CacheNumberOfRegionsForObjects"), getObjectCacheVersion());
- // 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;
- 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);
-
return true;
}