コード例 #1
0
        public bool TryGetValue(CacheKey key, out TimedEntityTagHeaderValue eTag)
        {
            eTag = null;

            if (key == null)
            {
                return(false);
            }

            var operationResult = _memcachedClient.Get <string>(key.HashBase64);

            if (operationResult == null)
            {
                return(false);
            }

            var value = operationResult;

            if (!TimedEntityTagHeaderValue.TryParse(value, out eTag))
            {
                return(false);
            }

            return(true);
        }
コード例 #2
0
ファイル: RedisEntityTagStore.cs プロジェクト: doriswang/Test
        public bool TryGetValue(CacheKey key, out TimedEntityTagHeaderValue eTag)
        {
            eTag = null;
            string value = _database.StringGet(key.HashBase64);

            if (value != null)
            {
                return(TimedEntityTagHeaderValue.TryParse(value, out eTag));
            }
            return(false);
        }
コード例 #3
0
        public bool TryGetValue(CacheKey key, out TimedEntityTagHeaderValue eTag)
        {
            var cacheObject = _cache.Get(key.HashBase64, _regionName) as string;

            if (!TimedEntityTagHeaderValue.TryParse(cacheObject, out eTag))
            {
                return(false);
            }

            return(true);
        }
コード例 #4
0
        public static void ToStringAndTryParseTest(string tag, bool isWeak)
        {
            var headerValue = new TimedEntityTagHeaderValue(tag, isWeak);
            var s           = headerValue.ToString();
            TimedEntityTagHeaderValue headerValue2 = null;

            Assert.IsTrue(TimedEntityTagHeaderValue.TryParse(s, out headerValue2));
            Assert.AreEqual(headerValue.Tag, headerValue2.Tag);
            Assert.AreEqual(headerValue.LastModified.ToString(), headerValue2.LastModified.ToString());
            Assert.AreEqual(headerValue.IsWeak, headerValue2.IsWeak);
            Assert.AreEqual(headerValue.ToString(), headerValue2.ToString());
        }
コード例 #5
0
        public bool TryGetValue(CacheKey key, out TimedEntityTagHeaderValue eTag)
        {
            eTag = null;
            var operationResult = _memcachedClient.ExecuteGet <string>(key.HashBase64);

            if (!operationResult.Success || !operationResult.HasValue ||
                string.IsNullOrEmpty(operationResult.Value))
            {
                return(false);
            }

            var value = operationResult.Value;

            if (!TimedEntityTagHeaderValue.TryParse(value, out eTag))
            {
                return(false);
            }

            return(true);
        }