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

loresoft / MediatR.CommandQuery / 11974081197

22 Nov 2024 02:04PM UTC coverage: 60.328% (-0.02%) from 60.35%
11974081197

push

github

pwelter34
Update CacheableQueryBase.cs

402 of 761 branches covered (52.83%)

Branch coverage included in aggregate %.

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

1289 of 2042 relevant lines covered (63.12%)

19.98 hits per line

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

30.77
/src/MediatR.CommandQuery/Queries/CacheableQueryBase.cs
1
// Ignore Spelling: Cacheable
2

3
using System.Security.Claims;
4

5
using MediatR.CommandQuery.Definitions;
6

7
namespace MediatR.CommandQuery.Queries;
8

9
public abstract record CacheableQueryBase<TResponse> : PrincipalQueryBase<TResponse>, ICacheResult
10
{
11
    private DateTimeOffset? _absoluteExpiration;
12
    private TimeSpan? _slidingExpiration;
13

14
    protected CacheableQueryBase(ClaimsPrincipal? principal) : base(principal)
82✔
15
    {
16
    }
82✔
17

18

19
    public abstract string GetCacheKey();
20

NEW
21
    public virtual string? GetCacheTag() => null;
×
22

23
    public bool IsCacheable()
24
    {
25
        return _absoluteExpiration.HasValue
×
26
            || _slidingExpiration.HasValue;
×
27
    }
28

29

30
    public void Cache(DateTimeOffset? absoluteExpiration)
31
    {
32
        _absoluteExpiration = absoluteExpiration;
×
33
    }
×
34

35
    public void Cache(TimeSpan? expiration)
36
    {
37
        _slidingExpiration = expiration;
8✔
38
    }
8✔
39

40

41
    DateTimeOffset? ICacheResult.AbsoluteExpiration()
42
    {
43
        return _absoluteExpiration;
×
44
    }
45

46
    TimeSpan? ICacheResult.SlidingExpiration()
47
    {
48
        return _slidingExpiration;
×
49
    }
50
}
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