0

I can see the CM cache in /sitecore/admin/cache.aspx. Do we have web or stageweb or different server cache inside /sitecore/admin/cache.aspx?

I would like to clear the Sitecore cache in all the servers from the code.

2 Answers 2

1

On a Content Delivery server, access to the administrative pages usually is not available hence there is no direct option available to monitor Sitecore Cache for the CD server. In this blog, I will explain how to monitor cache tunning on a CD server.

  • Go to the CD server and check the App_Data\diagnostics\health_monitor folder.
  • You will get their file named CacheStatus.20230412Z.141522Z.html where 20230412Z.141522Z is a time stamp. (Sitecore saves a copy of the cache.aspx page every ten minutes)

Note: In most cases you will get the file under the folder but in case you cannot find the file then you need to enable it.

  • Go to the \App_Config\Sitecore\CMS.Core folder on CD server.
  • Verify that Sitecore.Diagnostics.config file is enabled or not.
  • Remove the ".disabled" extension of the file to enable it. (The configuration for the health_monitor folder is in this configuration patch.)
  • Verify your App_Data\diagnostics\health_monitor folder after 10 minutes, you will see the file below. (It previews from the Azure PaaS portal in the web browser)

enter image description here

See the blog post for more details:

0

In order to clear the cache from CD server, you will need to add below configuration.

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

In the above configurarion, publish:end event clears the cache on CM server and publish:end:remote event clears the cache on CD server. Whenever you run the publishing on CMS,this will make sure cache gets cleared on CM as well as CD server.

Note: Add the site names in the above configuration for the sites you would like to clear cache on publish.

You can also browse the cache on CD server, same as you browse on CM server(sitecore/admin/cache.aspx) by navigating to the data folder at the below location.

$(dataFolder)/diagnostics/health_monitor/CacheStatus.{date}.{time}.html

In order to view the above folder on CD server, make sure the following configuration is enabled.

App_Config/Sitecore/CMS.Core/Sitecore.Diagnostics.config

Hope this helps.

4
  • is it same for staging as well ? Commented Apr 24 at 7:25
  • @CHUKKAPRASAD ya same as staging as well..It includes sitename to clear the cache...you can have the same config for staging as well.
    – ckhanna
    Commented Apr 24 at 8:15
  • Can you please let me know why we need to define ":end" in event name. Can we follow this "publish:remote" instead of "publish:end:remote" ? Commented Apr 25 at 10:19
  • @CHUKKAPRASAD publish:end event is fired on content authoring side and publish:end:remote is fired for the CD server using the event queue mechanism. Hence we need to use the configuration as defined above.
    – ckhanna
    Commented Apr 25 at 13:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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