forked from wkallhof/Simple301
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from patrickdemooij9/feature/LoadBalancingCache
Make sure to clear cache for load balancing websites
- Loading branch information
Showing
4 changed files
with
44 additions
and
4 deletions.
There are no files selected for viewing
12 changes: 12 additions & 0 deletions
12
source/SimpleRedirects.Core/Notifications/RedirectCacheRefresherNotification.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
using Umbraco.Cms.Core.Notifications; | ||
using Umbraco.Cms.Core.Sync; | ||
|
||
namespace SimpleRedirects.Core.Notifications | ||
{ | ||
public class RedirectCacheRefresherNotification : CacheRefresherNotification | ||
{ | ||
public RedirectCacheRefresherNotification(object messageObject, MessageType messageType) : base(messageObject, messageType) | ||
{ | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
source/SimpleRedirects.Core/Utilities/Caching/RedirectCacheRefresher.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
using System; | ||
using SimpleRedirects.Core.Notifications; | ||
using Umbraco.Cms.Core.Cache; | ||
using Umbraco.Cms.Core.Events; | ||
|
||
namespace SimpleRedirects.Core.Utilities.Caching | ||
{ | ||
public class RedirectCacheRefresher : CacheRefresherBase<RedirectCacheRefresherNotification> | ||
{ | ||
public static readonly Guid UniqueId = Guid.Parse("fe3847bc-80c4-4ce0-abde-551bb409599a"); | ||
|
||
public RedirectCacheRefresher(AppCaches appCaches, IEventAggregator eventAggregator, ICacheRefresherNotificationFactory factory) : base(appCaches, eventAggregator, factory) | ||
{ | ||
} | ||
|
||
public override Guid RefresherUniqueId => UniqueId; | ||
public override string Name => "Redirects Cache Refresher"; | ||
|
||
public override void RefreshAll() | ||
{ | ||
AppCaches.RuntimeCache.ClearByKey(RedirectRepository.CacheCategoryKey); | ||
base.RefreshAll(); | ||
} | ||
} | ||
} |