Caching 如何在自定义模块中更改设置后清除DNN缓存
当我更新了某个DNN模块中的设置时,如何以编程方式清除DNN缓存 我有下面的代码来检查DNN中是否缓存了一些东西Caching 如何在自定义模块中更改设置后清除DNN缓存,caching,dotnetnuke,Caching,Dotnetnuke,当我更新了某个DNN模块中的设置时,如何以编程方式清除DNN缓存 我有下面的代码来检查DNN中是否缓存了一些东西 /// <summary> /// Loads the Web Home Page Categories set up in ERP /// </summary> /// <param name="requestData"></param> /// <returns></returns> /// <rema
/// <summary>
/// Loads the Web Home Page Categories set up in ERP
/// </summary>
/// <param name="requestData"></param>
/// <returns></returns>
/// <remarks>RB 2017-08-17
/// RB 2017-09-18: Added Caching so that the result is loaded from cache instead of calling the server again</remarks>
[AllowAnonymous]
[HttpPost]
public string GetWebHomePagePublishingCategories([FromBody] ParrotRequestBase requestData)
{
GlobalSettings GV = GetGlobalSettingsForCurrentUser(requestData.UserID, requestData.CompanyID);
string cacheKey = Constants.conWebHomePagesCacheKey; //"WebHomePagesCacheKey";
var cache = DataCache.GetCache(cacheKey);
if (cache == null)
{
var timeOut = 20 * Convert.ToInt32(Host.PerformanceSetting);
cache = m_PubCtrl.WebHomePageCategories(GV.Globalvars, requestData);
if (timeOut > 0 & cache != null)
{
DataCache.SetCache(cacheKey, cache, TimeSpan.FromMinutes(timeOut));
}
}
return cache.ToString();
}
您可以在DotNetNuke.Common.Utilities中使用DataCache类
还有很多更清楚的。。。方法,所以检查它们是否适合您的需要
DataCache.ClearCache();
//or
DataCache.ClearModuleCache(TabId);