< Summary

Information
Class: PartsInfo.Cache.UrlResponseCacheService
Assembly: OzonOrdersWeb
File(s): /home/runner/work/Studio2Prod/Studio2Prod/OzonOrdersWeb/WebServices/Cache/UrlResponseCacheService.cs
Line coverage
100%
Covered lines: 6
Uncovered lines: 0
Coverable lines: 6
Total lines: 23
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%
TryGet(...)100%11100%
Set(...)100%11100%

File(s)

/home/runner/work/Studio2Prod/Studio2Prod/OzonOrdersWeb/WebServices/Cache/UrlResponseCacheService.cs

#LineLine coverage
 1using Microsoft.Extensions.Caching.Memory;
 2
 3namespace PartsInfo.Cache;
 4
 5public class UrlResponseCacheService
 6{
 7    private readonly IMemoryCache _cache;
 8
 189    public UrlResponseCacheService(IMemoryCache cache)
 10    {
 1811        _cache = cache;
 1812    }
 13
 14    public bool TryGet(string url, out string content)
 15    {
 1316        return _cache.TryGetValue(url, out content!);
 17    }
 18
 19    public void Set(string url, string content, TimeSpan duration)
 20    {
 721        _cache.Set(url, content, duration);
 722    }
 23}