< Summary

Information
Class: Elsa.Http.Services.HttpWorkflowsCacheManager
Assembly: Elsa.Http
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Http/Services/HttpWorkflowsCacheManager.cs
Line coverage
100%
Covered lines: 12
Uncovered lines: 0
Coverable lines: 12
Total lines: 39
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%
get_Cache()100%11100%
EvictWorkflowAsync()100%11100%
EvictTriggerAsync()100%11100%
GetWorkflowChangeTokenKey(...)100%11100%
GetTriggerChangeTokenKey(...)100%11100%
ComputeBookmarkHash(...)100%11100%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Http/Services/HttpWorkflowsCacheManager.cs

#LineLine coverage
 1using Elsa.Caching;
 2using Elsa.Http.Bookmarks;
 3using Elsa.Workflows;
 4
 5namespace Elsa.Http.Services;
 6
 7/// <inheritdoc />
 18public class HttpWorkflowsCacheManager(ICacheManager cache, IHasher bookmarkHasher) : IHttpWorkflowsCacheManager
 9{
 10    /// <inheritdoc />
 21511    public ICacheManager Cache => cache;
 12
 13    /// <inheritdoc />
 14    public async Task EvictWorkflowAsync(string workflowDefinitionId, CancellationToken cancellationToken = default)
 15    {
 92916        var changeTokenKey = GetWorkflowChangeTokenKey(workflowDefinitionId);
 92917        await cache.TriggerTokenAsync(changeTokenKey, cancellationToken);
 92918    }
 19
 20    /// <inheritdoc />
 21    public async Task EvictTriggerAsync(string bookmarkHash, CancellationToken cancellationToken = default)
 22    {
 1723        var changeTokenKey = GetTriggerChangeTokenKey(bookmarkHash);
 1724        await cache.TriggerTokenAsync(changeTokenKey, cancellationToken);
 1725    }
 26
 27    /// <inheritdoc />
 113628    public string GetWorkflowChangeTokenKey(string workflowDefinitionId) => $"{GetType().FullName}:workflow:{workflowDef
 29
 30    /// <inheritdoc />
 22731    public string GetTriggerChangeTokenKey(string bookmarkHash) => $"{GetType().FullName}:trigger:{bookmarkHash}:changeT
 32
 33    /// <inheritdoc />
 34    public string ComputeBookmarkHash(string path, string method)
 35    {
 136        var bookmarkPayload = new HttpEndpointBookmarkPayload(path, method);
 137        return bookmarkHasher.Hash(HttpStimulusNames.HttpEndpoint, bookmarkPayload);
 38    }
 39}