Example #1
0
        public void CustomerMemoryCacheWithCacheItemPolicy()
        {
            var customerManager = new MemoryCacheManager <Customer, IEnumerable <Customer> >(
                new MemoryCache <IEnumerable <Customer> >(CustomerPrefix));

            for (var i = 0; i < 10; i++)
            {
                var data = customerManager.GetData(_customerQuery);
                Console.WriteLine(data.Count());
                Thread.Sleep(100);
            }
        }
Example #2
0
        public void CategoryMemoryCacheWithCacheItemPolicy()
        {
            var categoryManager = new MemoryCacheManager <Category, IEnumerable <Category> >(
                new MemoryCache <IEnumerable <Category> >(CategoryPrefix));

            for (var i = 0; i < 10; i++)
            {
                var data = categoryManager.GetData(_categoryQuery);
                Console.WriteLine(data.Count());
                Thread.Sleep(100);
            }
        }
Example #3
0
        public void CategoryMemoryCacheWithDateTimeOffset()
        {
            var categoryManager = new MemoryCacheManager <Category, IEnumerable <Category> >(
                new MemoryCache <IEnumerable <Category> >(CategoryPrefix));

            for (var i = 0; i < 10; i++)
            {
                var dateTimeOffset = new DateTimeOffset(DateTime.UtcNow.AddMilliseconds(_millisecondsOffset));
                Console.WriteLine(categoryManager.GetData(dateTimeOffset).Count());
                Thread.Sleep(100);
            }
        }
Example #4
0
        public void OrderMemoryCacheWithDateTimeOffset()
        {
            var orderManager = new MemoryCacheManager <Order, IEnumerable <Order> >(
                new MemoryCache <IEnumerable <Order> >(OrderPrefix));

            for (var i = 0; i < 10; i++)
            {
                var dateTimeOffset = new DateTimeOffset(DateTime.UtcNow.AddMilliseconds(_millisecondsOffset));
                var data           = orderManager.GetData(dateTimeOffset);
                Console.WriteLine(data.Count());
                Thread.Sleep(100);
            }
        }