Provide "quick" option for loading database into RAM

The directory cache and the database's Load to RAM feature
each result in a much better user experience.

But, when both features are enabled at the same time, it
can take a very long time on older players - easily several
minutes for larger libraries - until all of the database's
dircache references have been updated.

Include a 'Quick' option that causes the database to ignore
dircache references which can *significantly* reduce disk
activity after booting.

Change-Id: I25ae779c97d03885b06d5a28d8be55c0d05692a5
This commit is contained in:
Christian Soffke 2023-10-07 15:10:53 +02:00
parent 4a52147122
commit 3ce3b102dd
5 changed files with 45 additions and 6 deletions

View file

@ -800,7 +800,8 @@ static long find_entry_ram(const char *filename)
struct dircache_fileref dcfref;
/* Check if tagcache is loaded into ram. */
if (!tc_stat.ramcache)
if (!tc_stat.ramcache
|| global_settings.tagcache_ram != TAGCACHE_RAM_ON)
return -1;
if (dircache_search(DCS_CACHED_PATH | DCS_UPDATE_FILEREF, &dcfref,
@ -5247,7 +5248,8 @@ static void tagcache_thread(void)
if (!tc_stat.ramcache && global_settings.tagcache_ram)
{
load_ramcache();
check_file_refs(global_settings.tagcache_autoupdate);
if (global_settings.tagcache_ram == TAGCACHE_RAM_ON)
check_file_refs(global_settings.tagcache_autoupdate);
if (tc_stat.ramcache && global_settings.tagcache_autoupdate)
tagcache_build();
}