Allow nucache content and/or media db files to be reused if they already exist.

This commit is contained in:
JohnBlair
2019-10-17 18:46:11 +01:00
committed by Shannon
parent 7afdf9e9a9
commit 7ace5baf9b
2 changed files with 20 additions and 16 deletions

View File

@@ -128,10 +128,12 @@ namespace Umbraco.Web.PublishedCache.NuCache
var path = GetLocalFilesPath();
var localContentDbPath = Path.Combine(path, "NuCache.Content.db");
var localMediaDbPath = Path.Combine(path, "NuCache.Media.db");
_localDbExists = File.Exists(localContentDbPath) && File.Exists(localMediaDbPath);
var localContentDbExists = File.Exists(localContentDbPath);
var localMediaDbExists = File.Exists(localMediaDbPath);
_localDbExists = localContentDbExists && localMediaDbExists;
// if both local databases exist then GetTree will open them, else new databases will be created
_localContentDb = BTree.GetTree(localContentDbPath, _localDbExists);
_localMediaDb = BTree.GetTree(localMediaDbPath, _localDbExists);
_localContentDb = BTree.GetTree(localContentDbPath, localContentDbExists);
_localMediaDb = BTree.GetTree(localMediaDbPath, localMediaDbExists);
_logger.Info<PublishedSnapshotService>($"Registered with MainDom, local db exists? {_localDbExists}");
},