Sitecore 词典项目

Sitecore Dictionary Items

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

1) Sitecore 8 是否仍然存在这个问题?

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

  1. 我在 Sitecore 8.1 初始版本上遇到了这个问题。
  2. 要修复它,您需要在 publish:end 和 publish:end:remote 事件上添加一个新的处理程序。 这是 class :

    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);
    }
    } 
    

    在 publish:end 和 publish:end 上:远程事件你将有:

    <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>
    

    您在这里找到的其他修复:https://community.sitecore.net/developers/f/8/t/173