Beispiel #1
0
        private MemoryCacheEntryOptions _cacheEntryOptions;//todo: use redis cache

        public LookupDataRepository(AudioBookContext context, IMapper mapper, IMemoryCache cache, IConfiguration configuration)
        {
            _context     = context ?? throw new ArgumentNullException(nameof(context));
            this._mapper = mapper ?? throw new ArgumentNullException(nameof(mapper));
            this._cache  = cache;

            int durationInSeconds = 300;

            int.TryParse(configuration.GetValue <string>("Cache:DurationInSeconds"), out durationInSeconds);
            this._cacheEntryOptions = new MemoryCacheEntryOptions().SetSlidingExpiration(TimeSpan.FromSeconds(durationInSeconds)); //todo:use a
        }
 public AudioBookRepository(AudioBookContext context)
 {
     _context = context ?? throw new ArgumentNullException(nameof(context));
 }