Exemple #1
0
        public async Task <Pair> GetPairAsync(Guid id)
        {
            Pair _companies = await _memoryCache.GetOrCreateAsync <Pair>(id, async entry =>
            {
                entry.SlidingExpiration = TimeSpan.FromDays(30);
                return(await _retrieverRepository.GetByIdAsync <Pair>(id));
            });

            return(_companies);
        }
Exemple #2
0
        public async Task <Currency> GetCurrencyAsync(Guid id)
        {
            Currency currency = await _memoryCache.GetOrCreateAsync <Currency>(id, async entry =>
            {
                entry.SlidingExpiration = TimeSpan.FromMinutes(1);
                return(await _retrieverRepository.GetByIdAsync <Currency>(id));
            });

            if (currency == null)
            {
                _memoryCache.Remove(id);
            }

            return(currency);
        }
 public async Task <Transaction> GetAsync(Guid id)
 {
     return(await _retrieverRepository.GetByIdAsync <Transaction>(id));
 }