Esempio n. 1
0
        public async Task <List <Product> > GetAllProductsAsync()
        {
            var products = await _cache.GetDataAsync <List <Product> >(_productsKey);

            if (products is null)
            {
                products = await _database.Products
                           .Include(x => x.Category)
                           .ToListAsync();

                await _cache.AddDataAsync(_productsKey, products);
            }

            return(products);
        }