using System; using System.Collections.Generic; using System.Linq; using CB.Cache; using CB.Entity; namespace CB.Data { public partial class Caches { /// /// 获取模板列表 /// /// public static IList GetTemplateList() { var cache = CBCache.GetCacheService(); IList list = cache.GetObject(CacheKeys.TemplateList) as IList; if (null == list) { list = TemplateService.ToList(); cache.AddObject(CacheKeys.TemplateList, list); } return list; } /// /// 获取模板详情 /// /// /// public static TemplateInfo GetTemplateInfo(int tid) { var list = GetTemplateList(); if (null == list || 0 >= list.Count) return null; return list.FirstOrDefault(item => tid == item.Id); } } }