Exemplo n.º 1
0
        /// <summary>
        /// 캐시에 저장된 정보를 가져옵니다.
        /// </summary>
        /// <param name="client">MemcachedClient 인스턴스</param>
        /// <param name="key">캐시 키</param>
        /// <param name="newExpiresAt">새로운 유효기간</param>
        /// <returns>저장된 캐시 값</returns>
        public static T GetValue <T>(this MemcachedClient client, string key, DateTime newExpiresAt)
        {
            key.ShouldNotBeWhiteSpace("key");

            if (IsDebugEnabled)
            {
                log.Debug("캐시 정보를 로드합니다. key=[{0}], newExpiresAt=[{1}]", key, newExpiresAt);
            }

            T value;

            if (client.TryGetValue(key, out value))
            {
                client.SetValue(key, value, newExpiresAt);
            }

            return(value);
        }