Esempio n. 1
0
        /// <summary>
        /// 向缓存池存入值,数据缓存指定时间
        /// 默认缓存1天
        /// </summary>
        /// <param name="poolName">缓存池名</param>
        /// <param name="key">缓存键</param>
        /// <param name="value">缓存内容</param>
        /// <param name="cacheTime">缓存时间值</param>
        /// <param name="cacheType">1-天为单位,2小时为单位,3-分钟为单位</param>
        /// <returns></returns>
        public static bool SetMemValues(string poolName, string key, string value, int cacheTime, int cacheType)
        {
            DateTime d1 = DateTime.Now.AddDays(1.0);

            switch (cacheType)
            {
            case 1:
                d1 = DateTime.Now.AddDays((double)cacheTime);
                break;

            case 2:
                d1 = DateTime.Now.AddHours((double)cacheTime);
                break;

            case 3:
                d1 = DateTime.Now.AddMinutes((double)cacheTime);
                break;
            }
            return(CacheMethod.setMemCacheValues(poolName, key, value, d1));
        }
Esempio n. 2
0
 /// <summary>
 /// 向缓存池存入值,数据缓存指定时间
 /// </summary>
 /// <param name="poolName">缓存池名</param>
 /// <param name="key">缓存键</param>
 /// <param name="value">缓存内容</param>
 /// <param name="ExpiredTime">失效时间</param>
 /// <returns></returns>
 public static bool SetMemValuesExpiredTime(string poolName, string key, string value, DateTime ExpiredTime)
 {
     return(CacheMethod.setMemCacheValues(poolName, key, value, ExpiredTime));
 }
Esempio n. 3
0
        /// <summary>
        /// 向缓存池存入值,数据缓存默认分钟数
        /// </summary>
        /// <param name="poolName">缓存池名</param>
        /// <param name="key">缓存键</param>
        /// <param name="value">缓存内容</param>
        /// <returns></returns>
        public static bool setMemcacheValueInMinutes(string poolName, string key, string value)
        {
            DateTime d1 = DateTime.Now.AddMinutes(double.Parse(CacheConfig.CacheMinutes));

            return(CacheMethod.setMemCacheValues(poolName, key, value, d1));
        }
Esempio n. 4
0
        /// <summary>
        /// 向缓存池存入值,数据缓存默认天数
        /// </summary>
        /// <param name="poolName">缓存池名</param>
        /// <param name="key">缓存键</param>
        /// <param name="Value">缓存内容</param>
        /// <returns></returns>
        public static bool setMemcachedValue(string poolName, string key, string Value)
        {
            DateTime d1 = DateTime.Now.AddDays(double.Parse(CacheConfig.CacheDays));

            return(CacheMethod.setMemCacheValues(poolName, key, Value, d1));
        }