From 009f071f486f26630451de86337702e5cdc87a21 Mon Sep 17 00:00:00 2001 From: Stephan Date: Tue, 19 May 2015 14:04:32 +0200 Subject: [PATCH] XmlCache - comments --- src/Umbraco.Web/umbraco.presentation/content.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Umbraco.Web/umbraco.presentation/content.cs b/src/Umbraco.Web/umbraco.presentation/content.cs index b5a3d98758..64380b1484 100644 --- a/src/Umbraco.Web/umbraco.presentation/content.cs +++ b/src/Umbraco.Web/umbraco.presentation/content.cs @@ -42,11 +42,14 @@ namespace umbraco { if (XmlFileEnabled) { + // if we use the file, prepare the lock InitializeFileLock(); } if (SyncToXmlFile) { + // if we write to file, prepare the persister task + // there's always be one task keeping a ref to the runner // so it's safe to just create it as a local var here var runner = new BackgroundTaskRunner(new BackgroundTaskRunnerOptions @@ -63,7 +66,12 @@ namespace umbraco using (var safeXml = GetSafeXmlWriter(false)) { bool registerXmlChange; + + // if we don't use the file then LoadXmlLocked will not even + // read from the file and will go straight to database LoadXmlLocked(safeXml, out registerXmlChange); + // if we use the file and registerXmlChange is true this will + // write to file, else it will not safeXml.Commit(registerXmlChange); } }