diff --git a/OpenContent/Components/Caching/DnnCacheAdapter.cs b/OpenContent/Components/Caching/DnnCacheAdapter.cs
index 55453132..4e6aefed 100644
--- a/OpenContent/Components/Caching/DnnCacheAdapter.cs
+++ b/OpenContent/Components/Caching/DnnCacheAdapter.cs
@@ -1,6 +1,3 @@
-using System;
-using System.Collections;
-using System.Collections.Generic;
using DotNetNuke.Common.Utilities;
using DotNetNuke.Data;
using DotNetNuke.Entities.Modules;
@@ -9,6 +6,9 @@
using DotNetNuke.Services.Cache;
using DotNetNuke.Services.ModuleCache;
using DotNetNuke.Services.OutputCache;
+using System;
+using System.Collections;
+using System.Collections.Generic;
namespace Satrabel.OpenContent.Components
{
@@ -62,10 +62,52 @@ private static void SyncronizeLinkedModules(int portalId, int dataModuleId)
foreach (var ocModule in ocModules)
{
if (ocModule.DataModule.ModuleId == dataModuleId)
- SynchronizeModule(ocModule.ViewModule.ModuleId);
+ SynchronizeViewModule(ocModule.ViewModule.ModuleInfo);
+ }
+ }
+
+ ///
+ /// Synchronizes the cache.
+ ///
+ ///
+ /// Based on DNN SynchronizeModule(int moduleID)
+ ///
+ private static void SynchronizeViewModule(ModuleInfo module)
+ {
+ DataProvider dataProvider = DataProvider.Instance();
+ //IList modules = ModuleController.Instance.GetTabModulesByModule(moduleId);
+
+ Hashtable tabSettings = TabController.Instance.GetTabSettings(module.TabID);
+ if (tabSettings["CacheProvider"] != null && tabSettings["CacheProvider"].ToString().Length > 0)
+ {
+ var outputProvider = OutputCachingProvider.Instance(tabSettings["CacheProvider"].ToString());
+ outputProvider?.Remove(module.TabID);
}
+
+ if (module.CacheTime > 0)
+ {
+ var cachingProvider = ModuleCachingProvider.Instance(module.GetEffectiveCacheMethod());
+ cachingProvider?.Remove(module.TabModuleID);
+ }
+
+ //Synchronize module is called when a module needs to indicate that the content
+ //has changed and the cache's should be refreshed. So we can update the Version
+ //and also the LastContentModificationDate
+ dataProvider.UpdateTabModuleVersion(module.TabModuleID, Guid.NewGuid());
+ dataProvider.UpdateModuleLastContentModifiedOnDate(module.ModuleID);
+
+ ////We should also indicate that the Transalation Status has changed
+ //if (PortalController.GetPortalSettingAsBoolean("ContentLocalizationEnabled", module.PortalID, false))
+ //{
+ // ModuleController.Instance.UpdateTranslationStatus(module, false);
+ //}
+
+ // and clear the cache
+ ModuleController.Instance.ClearCache(module.TabID);
+
}
+
///
/// Synchronizes the cache.
///
diff --git a/OpenContent/Components/OpenContentAPIController.cs b/OpenContent/Components/OpenContentAPIController.cs
index 87bb94b5..960efbaa 100644
--- a/OpenContent/Components/OpenContentAPIController.cs
+++ b/OpenContent/Components/OpenContentAPIController.cs
@@ -606,7 +606,7 @@ public HttpResponseMessage Update(JObject json)
{
ds.Update(dsContext, dsItem, json["form"] as JObject);
}
- //App.Services.CacheAdapter.SyncronizeCache(module);
+ App.Services.CacheAdapter.SyncronizeCache(module);
}
catch (DataNotValidException ex)
{