How would I go about creating an admin page to clear the cache on a CD server? Looking at this question/answer I would assume the following:
- Define a new cache:clear custom event in a new config patch file.
- Create a cs file to handle this custom event
- Create an admin aspx page (hosted on the CM server) to enable firing the event
Are there any other things I've missed here?
For the event handler, I was thinking something along the lines of
var siteContext = Sitecore.Sites.SiteContextFactory.GetSiteContext("MySite");
var cache = Sitecore.Caching.CacheManager.GetHtmlCache(siteContext);
cache.Clear();
aspx
file in the web root with your code, you could run a one-off, then delete the file.