예제 #1
0
        public override void Execute(CommandContext context)
        {
            Assert.ArgumentNotNull(context, "context");
            var cacheRegion = context.Parameters["region"];

            if (string.IsNullOrWhiteSpace(cacheRegion))
            {
                return;
            }

            var cacheRegions = cacheRegion.Split('|');

            var cacheEvent = new ClearCacheEvent(cacheRegions);

            //Sitecore.Eventing.EventManager.QueueEvent<ClearCacheEvent>(cacheEvent);
            //var eq = new Sitecore.Eventing.DefaultEventQueueProvider();
            //eq.QueueEvent<ClearCacheEvent>(cacheEvent);

            (new DefaultEventQueueProvider()).QueueEvent <ClearCacheEvent>(cacheEvent, true, true);

            SheerResponse.Alert(
                "The Cache has been queued for clearing. Please allow a few minutes for the process to complete");

            Log.Info(string.Format("Cache queued for clearing. Regions: {0}", cacheRegion), this);
        }
 /// <summary>
 /// Called by the EventQueue when a ClearCacheEvent is processed.
 /// </summary>
 /// <param name="e"></param>
 public static void Run(ClearCacheEvent e)
 {
     // Raise the clearcache event so the cache is cleared on this instance.
     Event.RaiseEvent("urlrewriter:clearcache", new ClearCacheEventArgs(e));
 }
예제 #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ClearCacheEventArgs"/> class.
 /// </summary>
 /// <param name="e">The event.</param>
 public ClearCacheEventArgs(ClearCacheEvent e)
 {
 }
 internal static void ClearCache()
 {
     ClearCacheEvent?.Invoke();
 }