1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using CB.Cache;
- using CB.Entity;
- namespace CB.Data
- {
- public partial class Caches
- {
- /// <summary>
- /// 走势图表帮助文章列表(限走势图表使用)
- /// </summary>
- /// <param name="cid">文章分类ID</param>
- /// <returns></returns>
- public static IList<TopicInfo> GetHelpList(int cid)
- {
- var key = CacheKeys.TopicList + "-" + cid.ToString();
- var cache = CBCache.GetCacheService();
- IList<TopicInfo> list = cache.GetObject(key) as IList<TopicInfo>;
- if (null == list)
- {
- list = TopicService.ToList(new TopicInfo() { Cid = cid });
- cache.AddObject(key, list);
- }
- return list;
- }
- /// <summary>
- /// 走势图表帮助文章列表(限走势图表使用)
- /// </summary>
- /// <param name="cid">文章分类ID</param>
- /// <param name="topSize">记录条数</param>
- /// <returns></returns>
- public static IList<TopicInfo> GetHelpList(int cid, int topSize)
- {
- var list = GetHelpList(cid);
- if (null == list || 0 >= list.Count)
- return null;
- IList<TopicInfo> r = new List<TopicInfo>();
- int count = list.Count;
- count = topSize >= count ? count : topSize;
- for (int i = 0; i < count; i++)
- {
- r.Add(list[i]);
- }
- return r;
- }
- }
- }
|