Files
Umbraco-CMS/src/Umbraco.Core/Events/INotificationHandler.cs
Ronald Barendse c989c5e214 Support publishing multiple notifications, filter on handler type and add IDistributedCacheNotificationHandler<TNotification> (optimizes cache refreshers) (#14332)
* Clean up DistributedCache and add additional checks

* Add IEnumerable overloads to DistributedCacheExtensions

* Update handlers to use new IEnumerable overloads

* Move DistributedCacheExtensions to Core

* Restructure cache refreshers into folders

* Add IDistributedCacheNotificationHandler

* Rewrite DistributedCacheBinder into seperate IDistributedCacheNotificationHandler implementations

* Obsolete DistributedCacheBinder and use new IDistributedCacheHandler implementations

* Clean up ServerMessengerBase

* Ensure cache refreshers only process distinct values

* Add support for publishing multiple notifications and filter on handler type

* Suppress compatibility issues

* Remove DistributedCacheBinder and suppress compatibility issues

* Add ScopedNotificationPublisher<TNotificationHandler>

* Improve notification type lookup/enumeration

* Ensure INotificationAsyncHandler handles multiple notitications sequentially

* Minimize cache instruction JSON

* Chunk notifications by type to keep publish order

* Only serialize required RefreshInstruction properties
2023-06-20 11:15:47 +02:00

39 lines
1.0 KiB
C#

// Copyright (c) Umbraco.
// See LICENSE for more details.
using Umbraco.Cms.Core.Notifications;
namespace Umbraco.Cms.Core.Events;
/// <summary>
/// Marker interface for notification handlers.
/// </summary>
public interface INotificationHandler
{ }
/// <summary>
/// Defines a handler for a notification.
/// </summary>
/// <typeparam name="TNotification">The type of notification being handled.</typeparam>
public interface INotificationHandler<in TNotification> : INotificationHandler
where TNotification : INotification
{
/// <summary>
/// Handles a notification.
/// </summary>
/// <param name="notification">The notification.</param>
void Handle(TNotification notification);
/// <summary>
/// Handles the notifications.
/// </summary>
/// <param name="notifications">The notifications.</param>
void Handle(IEnumerable<TNotification> notifications)
{
foreach (TNotification notification in notifications)
{
Handle(notification);
}
}
}