Rename caches so that they auto-rehash

This commit is contained in:
halgari 2024-01-15 17:23:36 -07:00
parent d25834c513
commit 61b3f70d5c
2 changed files with 5 additions and 5 deletions

View File

@ -65,14 +65,14 @@ public static class ServiceExtensions
service.AddSingleton(s => options.UseLocalCache service.AddSingleton(s => options.UseLocalCache
? new FileHashCache(s.GetService<TemporaryFileManager>()!.CreateFile().Path, ? new FileHashCache(s.GetService<TemporaryFileManager>()!.CreateFile().Path,
s.GetService<IResource<FileHashCache>>()!) s.GetService<IResource<FileHashCache>>()!)
: new FileHashCache(KnownFolders.AppDataLocal.Combine("Wabbajack", "GlobalHashCache.sqlite"), : new FileHashCache(KnownFolders.AppDataLocal.Combine("Wabbajack", "GlobalHashCache2.sqlite"),
s.GetService<IResource<FileHashCache>>()!)); s.GetService<IResource<FileHashCache>>()!));
service.AddSingleton<IVfsCache>(s => service.AddSingleton<IVfsCache>(s =>
{ {
var diskCache = options.UseLocalCache var diskCache = options.UseLocalCache
? new VFSDiskCache(s.GetService<TemporaryFileManager>()!.CreateFile().Path) ? new VFSDiskCache(s.GetService<TemporaryFileManager>()!.CreateFile().Path)
: new VFSDiskCache(KnownFolders.WabbajackAppLocal.Combine("GlobalVFSCache4.sqlite")); : new VFSDiskCache(KnownFolders.WabbajackAppLocal.Combine("GlobalVFSCache5.sqlite"));
var cesiCache = new CesiVFSCache(s.GetRequiredService<ILogger<CesiVFSCache>>(), var cesiCache = new CesiVFSCache(s.GetRequiredService<ILogger<CesiVFSCache>>(),
s.GetRequiredService<Client>()); s.GetRequiredService<Client>());
return new FallthroughVFSCache(new IVfsCache[] {diskCache}); return new FallthroughVFSCache(new IVfsCache[] {diskCache});
@ -92,7 +92,7 @@ public static class ServiceExtensions
TimeSpan.FromDays(1), TimeSpan.FromDays(1),
dtos) dtos)
: new VerificationCache(s.GetRequiredService<ILogger<VerificationCache>>(), : new VerificationCache(s.GetRequiredService<ILogger<VerificationCache>>(),
KnownFolders.WabbajackAppLocal.Combine("VerificationCacheV2.sqlite"), KnownFolders.WabbajackAppLocal.Combine("VerificationCacheV3.sqlite"),
TimeSpan.FromDays(1), TimeSpan.FromDays(1),
dtos); dtos);
}); });

View File

@ -40,9 +40,9 @@ public class Startup
// Keep this fixed at 2 so that we can detect deadlocks in the VFS parallelOptions // Keep this fixed at 2 so that we can detect deadlocks in the VFS parallelOptions
service.AddSingleton(new ParallelOptions {MaxDegreeOfParallelism = 2}); service.AddSingleton(new ParallelOptions {MaxDegreeOfParallelism = 2});
service.AddSingleton(new FileHashCache(KnownFolders.EntryPoint.Combine("hashcache.sqlite"), service.AddSingleton(new FileHashCache(KnownFolders.EntryPoint.Combine("hashcache_2.sqlite"),
new Resource<FileHashCache>("File Hashing", 10))); new Resource<FileHashCache>("File Hashing", 10)));
service.AddAllSingleton<IVfsCache, VFSDiskCache>(x => new VFSDiskCache(KnownFolders.EntryPoint.Combine("vfscache.sqlite"))); service.AddAllSingleton<IVfsCache, VFSDiskCache>(x => new VFSDiskCache(KnownFolders.EntryPoint.Combine("vfscache_2.sqlite")));
service.AddTransient<Context>(); service.AddTransient<Context>();
service.AddSingleton<FileExtractor.FileExtractor>(); service.AddSingleton<FileExtractor.FileExtractor>();
} }