< Summary

Information
Class: Elsa.Workflows.Runtime.Handlers.InvalidateTriggersCache
Assembly: Elsa.Workflows.Runtime
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Runtime/Handlers/InvalidateTriggersCache.cs
Line coverage
100%
Covered lines: 4
Uncovered lines: 0
Coverable lines: 4
Total lines: 33
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%
HandleAsync(...)100%11100%
HandleAsync()100%11100%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Runtime/Handlers/InvalidateTriggersCache.cs

#LineLine coverage
 1using Elsa.Caching;
 2using Elsa.Mediator.Contracts;
 3using Elsa.Workflows.Runtime.Notifications;
 4using Elsa.Workflows.Runtime.Stores;
 5using JetBrains.Annotations;
 6
 7namespace Elsa.Workflows.Runtime.Handlers;
 8
 9/// <summary>
 10/// A notification handler that invalidates triggers cache when workflow definitions are refreshed.
 11/// </summary>
 12/// <remarks>
 13/// The class implements the <c>INotificationHandler</c> interface and is responsible for handling <c>WorkflowDefinition
 14/// When a <c>WorkflowDefinitionsRefreshed</c> notification is received, the <c>HandleAsync</c> method is called to inva
 15/// The cache is invalidated by calling the <c>TriggerTokenAsync</c> method of the <c>ICacheManager</c> passed to the cl
 16/// </remarks>
 17[UsedImplicitly]
 31918public class InvalidateTriggersCache(ICacheManager cacheManager) :
 19    INotificationHandler<WorkflowDefinitionsRefreshed>,
 20    INotificationHandler<WorkflowDefinitionsReloaded>
 21{
 22    /// <inheritdoc />
 23    public Task HandleAsync(WorkflowDefinitionsRefreshed notification, CancellationToken cancellationToken)
 24    {
 125        return cacheManager.TriggerTokenAsync(CachingTriggerStore.CacheInvalidationTokenKey, cancellationToken).AsTask()
 26    }
 27
 28    /// <inheritdoc />
 29    public async Task HandleAsync(WorkflowDefinitionsReloaded notification, CancellationToken cancellationToken)
 30    {
 631        await cacheManager.TriggerTokenAsync(CachingTriggerStore.CacheInvalidationTokenKey, cancellationToken);
 632    }
 33}