Пример #1
0
        public IEnumerable <OrderLiteDto> GetAllOrders()
        {
            IEnumerable <OrderLiteDto> orders;

            if (!_cache.TryGetValue("Orders", out orders))
            {
                Console.WriteLine("HEY EG ER EKKI MEÐ ÞETTA Boi");
                var cacheEntryOptions = new MemoryCacheEntryOptions().SetSlidingExpiration(TimeSpan.FromHours(8));
                orders = _repo.GetAllOrders();
                _cache.Set("Orders", orders, cacheEntryOptions);
            }
            return(orders);
        }