之前有看过论坛中 关于 数据使用缓存并也能保证数据能即时更新的帖子,也进行了修改,但在缓存类型上有点疑惑,CachingExpirationType 有七个类型,看过二次开发的文档,但是具体到外网发布的时候,数据会读很久,会有卡死的现象,后来只能未加缓存保证正常运营。数据代码如下,请给出意见,谢谢~~
return GetTopEntities(1, CachingExpirationType.SingleObject,
() =>
{
StringBuilder cacheKey = new StringBuilder();
cacheKey.Append(RealTimeCacheHelper.GetListCacheKeyPrefix(CacheVersionType.AreaVersion, "SectionId", typeid));
cacheKey.AppendFormat("GetEliteTopicByType::SectionId-{0}", typeid);
return cacheKey.ToString();
},
() =>
{
var sql = Sql.Builder;
var whereSql = Sql.Builder;
var orderSql = Sql.Builder;
sql.Select("spb_BarThreads.*").From("spb_BarThreads");
whereSql.Where("SectionId = @0", typeid);
whereSql.Where("Auditstatus = 40");//审核通过
whereSql.Where("IsEssential = 1");//设置精华
sql.Append(whereSql);
orderSql.OrderBy("ThreadId DESC");//根据创建日期倒序
sql.Append(orderSql);
return sql;