Пример #1
0
        /*
         * private static BasicThread GetThreadFromCache(int threadID)
         * {
         *  string cacheKey = string.Format(CacheKey_Thread, threadID);
         *  return CacheUtil.Get<BasicThread>(cacheKey);
         * }
         *
         * private static void RemoveThreadCache(int threadID)
         * {
         *  string cacheKey = string.Format(CacheKey_Thread, threadID);
         *  CacheUtil.Remove(cacheKey);
         * }
         *
         */

        /// <summary>
        /// 更新缓存的主题olThread 为newThread ,只更新BasicThreadV5中的属性,没有更新子类的属性 不更新点击数
        /// </summary>
        /// <param name="olThread"></param>
        /// <param name="newThread"></param>
        public static void UpdateThreadCache(BasicThread olThread, BasicThread newThread)
        {
            int totalView = olThread.TotalViews;

            olThread.CopyFrom(newThread);
            olThread.TotalViews = totalView;
        }
Пример #2
0
        /*
        private static BasicThread GetThreadFromCache(int threadID)
        {
            string cacheKey = string.Format(CacheKey_Thread, threadID);
            return CacheUtil.Get<BasicThread>(cacheKey);
        }

        private static void RemoveThreadCache(int threadID)
        {
            string cacheKey = string.Format(CacheKey_Thread, threadID);
            CacheUtil.Remove(cacheKey);
        }

        */
         
        /// <summary>
        /// 更新缓存的主题olThread 为newThread ,只更新BasicThreadV5中的属性,没有更新子类的属性 不更新点击数
        /// </summary>
        /// <param name="olThread"></param>
        /// <param name="newThread"></param>
        public static void UpdateThreadCache(BasicThread olThread, BasicThread newThread)
        {
            int totalView = olThread.TotalViews;
            olThread.CopyFrom(newThread);
            olThread.TotalViews = totalView;
        }