【发布时间】:2016-05-06 21:31:58
【问题描述】:
我相信 Sitecore 正在缓存项目的工作流值,我需要能够清除它。
场景是我发出一个 ajax 请求来确定特定项目是否存在,如果它确实存在,则检索其工作流字段值。用户填写表格,他们可以选择保存或提交该表格;当他们提交表单时,它会进入工作流状态。但是,即使我切换浏览器,LoiHasNoWorkflow 也会保留以前的值,除非我再次发布。我有一种清除某些缓存的方法,但我不确定哪个可能实际缓存了该字段。
public static bool ClearCache()
{
foreach (DictionaryEntry entry in HttpContext.Current.Cache)
{
HttpContext.Current.Cache.Remove((string)entry.Key);
}
Context.Database.Engines.TemplateEngine.Reset();
Context.ClientData.RemoveAll();
CacheManager.ClearAllCaches();
return true;
}
public bool LoiHasNoWorkflow => CBUtility.ClearCache() && string.IsNullOrEmpty(loi?.Fields["__Workflow"].Value);
如何确定项目的 __Workflow 值为何无法清除?我什至可以通过 Sitecore UI 删除项目、刷新页面并发出相同的请求,但在项目确实存在时获取值。
【问题讨论】:
-
你的ajax请求和表单提交访问master数据库了吗?当您阅读 LoiHasNoWorkflow 时,它正在访问 Web 数据库?
标签: sitecore sitecore7 sitecore-workflow