/// <summary> /// 论坛相关配置信息写入存储 /// </summary> /// <param name="config"></param> public static void BbsConfigStorage(this BbsConfig config) { using (MongoDbContext mc = new MongoDbContext(Const.MongoDbConn)) { if (mc.Collection <BbsConfig>().Count() > 0) { BbsConfig orgConfig = mc.Collection <BbsConfig>().Linq().First(); mc.Collection <BbsConfig>().Update(config, orgConfig); } else { mc.Collection <BbsConfig>().Insert(config); } } }
/// <summary> /// 从缓存读取论坛相关配置信息 /// </summary> /// <returns></returns> public static BbsConfig GetBbsConfigCache() { object cacheVal = Const.CoreCacheName.GetCache(CacheKey); if (null != cacheVal) { return((BbsConfig)cacheVal); } BbsConfig config = GetBbsConfigFromStorage(); if (null != config) { Const.CoreCacheName.SetCache(CacheKey, config); } return(config); }