4

I am trying to upgrade my application from Sitecore 9.0.2 to 9.3.

In my sitecore.config file, I have below setting :

<event name="publish:end">
  <handler type="Sitecore.Publishing.SmartHtmlCacheClearer, Sitecore.Kernel" method="ClearCache" resolve="true"/>
  <handler type="Sitecore.Publishing.RenderingParametersCacheClearer, Sitecore.Kernel" method="ClearCache"/>
</event>

In the previous version, instead of Sitecore.Publishing.SmartHtmlCacheClearer, it was Sitecore.Publishing.HtmlCacheClearer.

I have multiple sites, and I want to clear the HTML cache for each site. I have created a setting.config file with the below settings:

<events>
  <event name="publish:end">
    <handler type="Sitecore.Publishing.SmartHtmlCacheClearer, Sitecore.Kernel" method="ClearCache" resolve="true"/>
      <sites hint=list">
        <site name="WWW_EN_US">WWW_EN_US</site>
        <site name="WWW_EN_CA">WWW_EN_CA</site>
        <site name="WWW_FR_CA">WWW_FR_CA</site>
        <site name="WWW_DE_AT">WWW_DE_AT</site>
        <site name="WWW_DE_DE">WWW_DE_DE</site>

When I run my application, I get the below exceptions:

17412 18:53:20 ERROR Exception in schedule agent: Sitecore.ListManagement.Operations.UpdateListOperationsAgent
Exception: System.InvalidOperationException
Message: Could not find property 'site' on object of type: Sitecore.Publishing.SmartHtmlCacheClearer
Source: Sitecore.Kernel
   at Sitecore.Configuration.DefaultFactory.AssignProperties(Object obj, Object[] properties)
   at Sitecore.Configuration.DefaultFactory.AssignProperties(XmlNode configNode, String[] parameters, Object obj, Boolean assert, Boolean deferred, IFactoryHelper helper)
   at Sitecore.Configuration.DefaultFactory.CreateObject(XmlNode configNode, String[] parameters, Boolean assert, IFactoryHelper helper)
   at Sitecore.Configuration.DefaultFactory.CreateObject(XmlNode configNode, Boolean assert)
   at Sitecore.Events.Event.EventSubscribers.Add(String eventName, XmlNode configNode)
   at Sitecore.Events.Event.BuildConfigSubscribersFromConfiguration()
   at Sitecore.DependencyInjection.LazyResetable`1.get_Value()
   at Sitecore.Events.Event.RaiseEvent(String eventName, Object[] parameters)
   at Sitecore.Abstractions.BaseJob.Start()
   at Sitecore.Jobs.DefaultJobManager.RunJob(BaseJob job)
   at Sitecore.Jobs.DefaultJobManager.ProcessQueue()
   at Sitecore.Tasks.Scheduler.Agents.Agent.StartJob(BaseJob job)
   at Sitecore.Tasks.Scheduler.Agents.Agent.RunAgentJob()
   at Sitecore.Tasks.Scheduler.Agents.Agent.Execute()
   at Sitecore.Tasks.DefaultScheduler.Execute(BaseAgent agent)

Can someone please help.

9

Adding to @Gatogordo's answer, you may have a site configuration which includes the HtmlCacheClearer instead, such as:

<events>
  <event name="publish:end">
    <handler type="Sitecore.Publishing.HtmlCacheClearer, Sitecore.Kernel" method="ClearCache">
      <sites hint="list">
        <site hint="basic-company">basic-company</site>
      </sites>
    </handler>
  </event>
  <event name="publish:end:remote">
    <handler type="Sitecore.Publishing.HtmlCacheClearer, Sitecore.Kernel" method="ClearCache">
      <sites hint="list">
        <site hint="basic-company">basic-company</site>
      </sites>
    </handler>
  </event>
</events>

For me this was resulting in many log errors with:

ERROR Could not resolve type name: Sitecore.Publishing.HtmlCacheClearer, Sitecore.Kernel

And also an unhelpful message on screen after logging in:

Error: An error occured

Removing the above configuration solved this for me. As already stated, Sitecore 9.3 automatically clears the HTML cache for sites which use it, and does not require this additional configuration (finally!).

| improve this answer | |
5

Sitecore changed the way it handles HTML cache clearance in 9.3 so you don't need that <sites> list anymore in the handler.

See https://doc.sitecore.com/developers/93/sitecore-experience-manager/en/configure-html-caching.html for the information.

If you do not want the cache for a site to be cleared when you publish you can add the preventHtmlCacheClear attribute to the site definition like this:

<site name="custom_website" cacheHtml="true" preventHtmlCacheClear="true" … />

So in 9.3, it's on by default - you can turn it off if needed.

Your solution: if you want all your sites to clear the HTML caches, just remove the patch for the SmartHtmlCacheClearer.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.