Sitecore字典项

Sitecore字典项,sitecore,sitecore8,sitecore-mvc,sitecore8.1,Sitecore,Sitecore8,Sitecore Mvc,Sitecore8.1,在早期版本的Sitecore中,字典项存在问题,如果我们有CDs环境,有时可能无法在CDs服务器上更新dictionary.dat文件 1) Sitecore 8是否仍存在此问题 2) 如果是,为我的网站实现自定义词典项的最佳方法是什么 我在Sitecore 8.1初始版本中有这个问题 要修复它,您需要在publish:end和publish:end:remote事件上添加一个新的处理程序。 这是一节课: public class DictionaryCacheClearer { /// <

在早期版本的Sitecore中,字典项存在问题,如果我们有CDs环境,有时可能无法在CDs服务器上更新dictionary.dat文件

1) Sitecore 8是否仍存在此问题

2) 如果是,为我的网站实现自定义词典项的最佳方法是什么

  • 我在Sitecore 8.1初始版本中有这个问题
  • 要修复它,您需要在publish:end和publish:end:remote事件上添加一个新的处理程序。 这是一节课:

    public class DictionaryCacheClearer
    {
    /// <summary>
    /// Clears the whole dictionary domain cache.
    /// </summary>
    /// <param name="sender">The sender.</param>
    /// <param name="args">The <see cref="EventArgs"/> instance containing the event data.</param>
    public void ClearCache(object sender, EventArgs args)
    {
        Translate.ResetCache();
        Log.Info("Dictionary cleared", this);
    }
    } 
    
    公共类字典
    {
    /// 
    ///清除整个字典域缓存。
    /// 
    ///发送者。
    ///包含事件数据的实例。
    public void ClearCache(对象发送器、事件args args)
    {
    Translate.ResetCache();
    Log.Info(“字典已清除”,此项);
    }
    } 
    
    在发布:结束和发布:结束:远程事件时,您将拥有:

    <event name="publish:end:remote">
     <handler type="Sitecore.Publishing.HtmlCacheClearer, Sitecore.Kernel" method="ClearCache">
       <sites hint="list">
        <site s="1">YourSite</site>
       </sites>
      </handler>
     <handler type="YourNameSpace.DictionaryCacheClearer, YourAssembly" method="ClearCache" />
    </event>
    
    <event name="publish:end">
    <handler type="Sitecore.Publishing.HtmlCacheClearer, Sitecore.Kernel" method="ClearCache">
      <sites hint="list">
        <site s="1">YourSite</site>
      </sites>
    </handler>
    <handler type="YourNameSpace.DictionaryCacheClearer, YourAssembly" method="ClearCache" />
    </event>
    
    
    你的网站
    你的网站
    
    您可以在此处找到其他修复程序: