• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

loresoft / MediatR.CommandQuery / 11712653438

06 Nov 2024 10:05PM UTC coverage: 59.479%. Remained the same
11712653438

push

github

pwelter34
fix dependance issue

389 of 741 branches covered (52.5%)

Branch coverage included in aggregate %.

0 of 1 new or added line in 1 file covered. (0.0%)

1208 of 1944 relevant lines covered (62.14%)

19.58 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/MediatR.CommandQuery/Behaviors/HybridCacheExpireBehavior.cs
1
using MediatR.CommandQuery.Definitions;
2

3
using Microsoft.Extensions.Caching.Hybrid;
4
using Microsoft.Extensions.Logging;
5

6
namespace MediatR.CommandQuery.Behaviors;
7

8
public partial class HybridCacheExpireBehavior<TRequest, TResponse> : PipelineBehaviorBase<TRequest, TResponse>
9
    where TRequest : class, IRequest<TResponse>
10
{
11
    private readonly HybridCache _hybridCache;
12

13
    public HybridCacheExpireBehavior(
14
        ILoggerFactory loggerFactory,
15
        HybridCache hybridCache)
16
        : base(loggerFactory)
×
17
    {
18
        ArgumentNullException.ThrowIfNull(hybridCache);
×
19

20
        _hybridCache = hybridCache;
×
21
    }
×
22

23
    protected override async Task<TResponse> Process(
24
        TRequest request,
25
        RequestHandlerDelegate<TResponse> next,
26
        CancellationToken cancellationToken)
27
    {
28
        ArgumentNullException.ThrowIfNull(request);
×
29
        ArgumentNullException.ThrowIfNull(next);
×
30

31
        var response = await next().ConfigureAwait(false);
×
32

33
        // expire cache
34
        if (request is not ICacheExpire cacheRequest)
×
35
            return response;
×
36

37
        var cacheTag = cacheRequest.GetCacheTag();
×
38
        if (!string.IsNullOrEmpty(cacheTag))
×
39
            await _hybridCache.RemoveByTagAsync(cacheTag, cancellationToken);
×
40

41
        return response;
×
42
    }
×
43
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc