< Summary

Information
Class: MRA.Services.Cache.CacheServiceBase
Assembly: MRA.Services
File(s): D:\a\MiguelRomerART\MiguelRomerART\MRA.Services\Cache\CacheServiceBase.cs
Line coverage
54%
Covered lines: 6
Uncovered lines: 5
Coverable lines: 11
Total lines: 36
Line coverage: 54.5%
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%
CleanCacheItem(...)100%210%
Clear()100%210%
GetOrSetFromCache(...)100%210%
GetOrSetFromCacheAsync()100%11100%

File(s)

D:\a\MiguelRomerART\MiguelRomerART\MRA.Services\Cache\CacheServiceBase.cs

#LineLine coverage
 1using MRA.Infrastructure.Cache;
 2using MRA.Infrastructure.Settings;
 3
 4namespace MRA.Services.Cache
 5{
 6    public class CacheServiceBase
 7    {
 8        internal readonly ICacheProvider _cache;
 9        internal readonly AppSettings _appSettings;
 10
 3611        public CacheServiceBase(AppSettings appSettings, ICacheProvider cache)
 12        {
 3613            _cache = cache;
 3614            _appSettings = appSettings;
 3615        }
 16
 17        public void CleanCacheItem(string item)
 18        {
 019            _cache.ClearCacheItem(item);
 020        }
 21        public void Clear()
 22        {
 023            _cache.Clear();
 024        }
 25
 26        public T GetOrSetFromCache<T>(string cacheKey, Func<T> getDataFunc)
 27        {
 028            return _cache.GetOrSetFromCache(cacheKey, getDataFunc);
 29        }
 30
 31        public async Task<T> GetOrSetFromCacheAsync<T>(string cacheKey, Func<Task<T>> getDataFunc, bool useCache)
 32        {
 3433            return await _cache.GetOrSetFromCacheAsync(cacheKey, getDataFunc, useCache);
 3434        }
 35    }
 36}