Technically you have to examen what happens inside: CMS\CMSModules\System\Controls\System.ascx.cs
. There is a piece that does exactly what you need:
// Clear the cache
CacheHelper.ClearCache(null, true);
Functions.ClearHashtables();
// Drop the routes
CMSDocumentRouteHelper.DropAllRoutes();
// Disposes all zip files
ZipStorageProvider.DisposeAll();
// Collect the memory
GC.Collect();
GC.WaitForPendingFinalizers();
// Log event
EventLogProvider.LogEvent(EventType.INFORMATION, "System", "CLEARCACHE", GetString("Administration-System.ClearCacheSuccess"));
ShowConfirmation(GetString("Administration-System.ClearCacheSuccess"));
The problem that you have to run this as Administrator and you have to put a lot of restrictions and checks for example:
- 1 restart for 30 mins
- access from only internal/specific IPs
etc...