Beispiel #1
0
        public void GetLastAccessed()
        {
            var redisStore = new RedisStore();
            var client = new HttpClient(new CachingHandler(redisStore)
            {
                InnerHandler = new HttpClientHandler()
            });

            var httpResponseMessage = client.GetAsync(CacheableResource1).Result;
            CacheItemMetadata metadata = redisStore.GetEarliestAccessedItem("ajax.googleapis.com");
            Assert.IsNotNull(metadata);
            Assert.AreEqual("ajax.googleapis.com", metadata.Domain);
            Assert.Less(DateTime.Now.Subtract(TimeSpan.FromSeconds(10)), metadata.LastAccessed);
        }
        public void GetLastAccessed()
        {
            var redisStore = new RedisStore();
            var client     = new HttpClient(new CachingHandler(redisStore)
            {
                InnerHandler = new HttpClientHandler()
            });

            var httpResponseMessage    = client.GetAsync(CacheableResource1).Result;
            CacheItemMetadata metadata = redisStore.GetEarliestAccessedItem("ajax.googleapis.com");

            Assert.IsNotNull(metadata);
            Assert.AreEqual("ajax.googleapis.com", metadata.Domain);
            Assert.Less(DateTime.Now.Subtract(TimeSpan.FromSeconds(10)), metadata.LastAccessed);
        }