diff --git a/DNN Platform/Library/Entities/Modules/Settings/SettingsRepository.cs b/DNN Platform/Library/Entities/Modules/Settings/SettingsRepository.cs
index 28ace91909c..eb93daf24f6 100644
--- a/DNN Platform/Library/Entities/Modules/Settings/SettingsRepository.cs
+++ b/DNN Platform/Library/Entities/Modules/Settings/SettingsRepository.cs
@@ -50,13 +50,13 @@ protected virtual string MappingCacheKey
///
public T GetSettings(ModuleInfo moduleContext)
{
- return CBO.GetCachedObject(new CacheItemArgs(this.CacheKey(moduleContext.PortalID), 20, CacheItemPriority.AboveNormal, moduleContext), this.Load, false);
+ return CBO.GetCachedObject(new CacheItemArgs(this.CacheKey(moduleContext.PortalID, moduleContext.TabModuleID), 20, CacheItemPriority.AboveNormal, moduleContext), this.Load, false);
}
///
public T GetSettings(int portalId)
{
- return CBO.GetCachedObject(new CacheItemArgs(this.CacheKey(portalId), 20, CacheItemPriority.AboveNormal, null, portalId), this.Load, false);
+ return CBO.GetCachedObject(new CacheItemArgs(this.CacheKey(portalId, -1), 20, CacheItemPriority.AboveNormal, null, portalId), this.Load, false);
}
///
@@ -164,7 +164,9 @@ private void SaveSettings(int portalId, ModuleInfo moduleContext, T settings)
}
}
});
- DataCache.SetCache(this.CacheKey(portalId), settings);
+
+ DataCache.ClearCache(this.CacheKeyPortalPrefix(portalId));
+ DataCache.SetCache(this.CacheKey(portalId, moduleContext?.TabModuleID ?? -1), settings);
}
private T Load(CacheItemArgs args)
@@ -220,7 +222,17 @@ private T Load(CacheItemArgs args)
return settings;
}
- private string CacheKey(int id) => $"Settings{this.MappingCacheKey}_{id}";
+ /// Gets the cache key for the given portal and tab module.
+ /// The portal ID.
+ /// The tab module ID.
+ /// When is -1, the cache key is for portal settings instead.
+ /// The cache key.
+ private string CacheKey(int portalId, int tabModuleId) => $"{this.CacheKeyPortalPrefix(portalId)}{tabModuleId}";
+
+ /// Gets the prefix of the cache key for the given portal.
+ /// The portal ID.
+ /// The cache key prefix.
+ private string CacheKeyPortalPrefix(int portalId) => $"Settings{this.MappingCacheKey}_{portalId}_";
/// Deserializes the property.
/// The settings.