< Summary

Information
Class: Elsa.Caching.Services.CacheManager
Assembly: Elsa.Caching
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Caching/Services/CacheManager.cs
Line coverage
100%
Covered lines: 6
Uncovered lines: 0
Coverable lines: 6
Total lines: 31
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_CachingOptions()100%11100%
GetToken(...)100%11100%
TriggerTokenAsync(...)100%11100%
<GetOrCreateAsync()100%11100%
GetOrCreateAsync()100%11100%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Caching/Services/CacheManager.cs

#LineLine coverage
 1using Elsa.Caching.Options;
 2using Microsoft.Extensions.Caching.Memory;
 3using Microsoft.Extensions.Options;
 4using Microsoft.Extensions.Primitives;
 5
 6namespace Elsa.Caching.Services;
 7
 8/// <inheritdoc />
 19public class CacheManager(IMemoryCache memoryCache, IChangeTokenSignaler changeTokenSignaler, IOptions<CachingOptions> o
 10{
 11    /// <inheritdoc />
 350812    public IOptions<CachingOptions> CachingOptions => options;
 13
 14    /// <inheritdoc />
 15    public IChangeToken GetToken(string key)
 16    {
 371417        return changeTokenSignaler.GetToken(key);
 18    }
 19
 20    /// <inheritdoc />
 21    public ValueTask TriggerTokenAsync(string key, CancellationToken cancellationToken = default)
 22    {
 267323        return changeTokenSignaler.TriggerTokenAsync(key, cancellationToken);
 24    }
 25
 26    /// <inheritdoc />
 27    public async Task<TItem?> GetOrCreateAsync<TItem>(object key, Func<ICacheEntry, Task<TItem>> factory)
 28    {
 793829        return await memoryCache.GetOrCreateAsync(key, async entry => await factory(entry));
 443030    }
 31}