示例#1
0
        private static void CacheDemo()
        {
            Console.Write("Getting item... ");

            var stopWatch = new System.Diagnostics.Stopwatch();

            stopWatch.Start();

            _cacheService.Get(
                "LargeObjectKey",
                GetObjectFromSomewhereSlowly,
                600);

            var detail = _cacheService.GetCacheItemDetail("LargeObjectKey");

            if (detail != null)
            {
                Console.WriteLine("Item is set to expire on: {0}", detail.ExpiresOn);
            }

            Console.WriteLine("That took {0} milliseconds to get", stopWatch.ElapsedMilliseconds);
            Console.WriteLine();
        }