How to clear cache on Sitecore 7.5 delivery server

2019-09-02 14:22发布

问题:

I have 2 CD servers using Sitecore 7.5 that have the actual Sitecore interfaces turned off. Is there any way for me to clear the caches on the 2 CD servers? I know that there is probably a way I could write code to do it, but I would be surprised that there is no way to do it out of the box.

Thanks, Corey

回答1:

As @Marek mentioned, you have to have your html cache clearing specified for your site in the web.config. Since you're trying to clear the cache on the CD servers, you have to have this defined in the publish:end:remote event vs the publish:end event.:

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

Assuming you have a new site defined that is not the OOTB website site definition, you just have to put your name in where I have YOUR SITE DEFINITION SITE NAME HERE above and your cache should clear on a publish.



回答2:

It couldn't be a neat solution but could fit into your specific requirment.

  • Take Sitecore's page for manual cache refresh. Website\sitecore\admin\cache.aspx
  • Copy into specific directory where you want this page to be accesses from.
  • Decomile Sitecore's dll 'Sitecore.sitecore.admin.CacheAdmin' and remove Sitecore authentication requirment from it and create your custom class.
  • Use that custom class in cache.aspx which you placed in CD server.