Sitecore Dictionary Items

浪尽此生 提交于 2019-12-11 01:49:44

问题


In the earlier versions of Sitecore there were an issue with dictionary items, if we have a CDs environment, sometimes the Dictionary.dat file may not get updated on CDs server.

1) is this issue still exist with Sitecore 8 ?

2) if yes, what is the best approach to implement custom dictionary items for my website ?


回答1:


  1. I have this issue on Sitecore 8.1 Initial Release.
  2. To fix it you need to add on publish:end and publish:end:remote event a new handler. This is the 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);
    }
    } 
    

    On publish:end and publish:end:remote events you will have:

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

    Other fix you find it here: https://community.sitecore.net/developers/f/8/t/173



来源:https://stackoverflow.com/questions/36233165/sitecore-dictionary-items

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!