public static PostsInfo GetItemByIndexAndTopics_id(uint?Index, ulong?Topics_id) { if (Index == null || Topics_id == null) { return(null); } if (itemCacheTimeout <= 0) { return(dal.GetItemByIndexAndTopics_id(Index, Topics_id)); } string key = string.Concat("cnodejs_BLL_PostsByIndexAndTopics_id_", Index, "_,_", Topics_id); string value = RedisHelper.Get(key); if (!string.IsNullOrEmpty(value)) { try { return(new PostsInfo(value)); } catch { } } PostsInfo item = dal.GetItemByIndexAndTopics_id(Index, Topics_id); if (item == null) { return(null); } RedisHelper.Set(key, item.Stringify(), itemCacheTimeout); return(item); }
public static PostsInfo GetItem(ulong?Id) { if (Id == null) { return(null); } if (itemCacheTimeout <= 0) { return(dal.GetItem(Id)); } string key = string.Concat("cnodejs_BLL_Posts_", Id); string value = RedisHelper.Get(key); if (!string.IsNullOrEmpty(value)) { try { return(new PostsInfo(value)); } catch { } } PostsInfo item = dal.GetItem(Id); if (item == null) { return(null); } RedisHelper.Set(key, item.Stringify(), itemCacheTimeout); return(item); }