< Summary

Information
Class: Elsa.Workflows.Management.Services.WorkflowDefinitionCacheManager
Assembly: Elsa.Workflows.Management
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Management/Services/WorkflowDefinitionCacheManager.cs
Line coverage
92%
Covered lines: 13
Uncovered lines: 1
Coverable lines: 14
Total lines: 48
Line coverage: 92.8%
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

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Workflows.Management/Services/WorkflowDefinitionCacheManager.cs

#LineLine coverage
 1using Elsa.Caching;
 2using Elsa.Common.Models;
 3using Elsa.Workflows.Management.Filters;
 4
 5namespace Elsa.Workflows.Management.Services;
 6
 7/// <inheritdoc />
 18public class WorkflowDefinitionCacheManager(ICacheManager cache, IHasher hasher) : IWorkflowDefinitionCacheManager
 9{
 10    /// <inheritdoc />
 117711    public ICacheManager Cache => cache;
 12
 13    /// <inheritdoc />
 214    public string CreateWorkflowDefinitionVersionCacheKey(string definitionId, VersionOptions versionOptions) => $"Workf
 15
 16    /// <inheritdoc />
 17    public string CreateWorkflowDefinitionFilterCacheKey(WorkflowDefinitionFilter filter)
 18    {
 52019        var hash = hasher.Hash(filter);
 52020        return $"WorkflowDefinition:{hash}";
 21    }
 22
 23    /// <inheritdoc />
 3524    public string CreateWorkflowVersionCacheKey(string definitionId, VersionOptions versionOptions) => $"Workflow:{defin
 25
 26    /// <inheritdoc />
 23127    public string CreateWorkflowVersionCacheKey(string definitionVersionId) => $"Workflow:{definitionVersionId}";
 28
 29    /// <inheritdoc />
 30    public string CreateWorkflowFilterCacheKey(WorkflowDefinitionFilter filter)
 31    {
 39032        var hash = hasher.Hash(filter);
 39033        return $"Workflow:{hash}";
 34    }
 35
 36    /// <inheritdoc />
 037    public string CreateWorkflowDefinitionVersionCacheKey(string definitionVersionId) => $"WorkflowDefinition:{definitio
 38
 39    /// <inheritdoc />
 116440    public string CreateWorkflowDefinitionChangeTokenKey(string definitionId) => $"WorkflowChangeToken:{definitionId}";
 41
 42    /// <inheritdoc />
 43    public async Task EvictWorkflowDefinitionAsync(string definitionId, CancellationToken cancellationToken = default)
 44    {
 64345        var changeTokenKey = CreateWorkflowDefinitionChangeTokenKey(definitionId);
 64346        await cache.TriggerTokenAsync(changeTokenKey, cancellationToken);
 64347    }
 48}