< Summary

Information
Class: Elsa.Caching.Features.MemoryCacheFeature
Assembly: Elsa.Caching
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Caching/Features/MemoryCacheFeature.cs
Line coverage
100%
Covered lines: 10
Uncovered lines: 0
Coverable lines: 10
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%
Apply()100%11100%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Caching/Features/MemoryCacheFeature.cs

#LineLine coverage
 1using Elsa.Caching.Options;
 2using Elsa.Caching.Services;
 3using Elsa.Features.Abstractions;
 4using Elsa.Features.Services;
 5using Microsoft.Extensions.DependencyInjection;
 6
 7namespace Elsa.Caching.Features;
 8
 9/// <summary>
 10/// Configures the MemoryCache.
 11/// </summary>
 112public class MemoryCacheFeature(IModule module) : FeatureBase(module)
 13{
 14    /// <summary>
 15    /// A delegate to configure the <see cref="CachingOptions"/>.
 16    /// </summary>
 317    public Action<CachingOptions> CachingOptions { get; set; } = _ => { };
 18
 19    /// <inheritdoc />
 20    public override void Apply()
 21    {
 122        Services.Configure(CachingOptions);
 23
 124        Services
 125            .AddMemoryCache()
 126            .AddSingleton<ICacheManager, CacheManager>()
 127            .AddSingleton<IChangeTokenSignalInvoker, ChangeTokenSignalInvoker>()
 128            .AddSingleton<IChangeTokenSignaler, ChangeTokenSignaler>()
 129            ;
 130    }
 31}