コード例 #1
0
 /// <summary>
 /// 存值
 /// </summary>
 /// <param name="key">键</param>
 /// <param name="value">值</param>
 /// <param name="expiry">失效时间(计算好的最后到期日期时间)</param>
 /// <returns></returns>
 public static bool Set(string key, object value, TimeSpan?expiry)
 {
     if (expiry.HasValue)
     {
         return(manager.StringSet <object>(key, value, expiry));
     }
     else
     {
         return(manager.StringSet <object>(key, value, DefaltTime));
     }
 }
コード例 #2
0
        /// <summary>
        /// 存值
        /// </summary>
        /// <param name="key">键</param>
        /// <param name="value">值</param>
        /// <param name="expiry">失效时间(计算好的最后到期日期时间)</param>
        /// <returns></returns>
        public static bool Set <T>(string key, T value, TimeSpan?expiry, long DBIndex)
        {
            var manager = new RedisManage((int)DBIndex);

            if (expiry.HasValue)
            {
                return(manager.StringSet <T>(key, value, expiry));
            }
            else
            {
                return(manager.StringSet <T>(key, value, DefaltTime));
            }
        }