实际上,博客帖子对于2sxc来说是一个非常不错的应用程序,但是每次用户打开博客时都能够注册,然后具有一个模块来显示例如5个其他已查看的帖子,这应该很棒。
基本上,我需要知道每次用户打开时如何更新帖子字段(例如,视图)或查看该帖子的详细信息
感谢您的帮助
这是一个有趣的主意-让我为您提供一些基本指导,以确保一切正常...
ViewCount
和BlogPostId
]创建类似Count
的东西>这里有一些伪代码要执行此操作...var postId = post.EntityId;
var cacheId = "PostCount" + postId;
var count = Application[cacheId] ?? -1;
if(count == -1) {
// load the data
var countStates = AsList(App.Data["ViewCount"]);
var counter = countStates.FirstOrDefault(c => c.BlogPostId == postId);
if(counter != null) {
count = counter.Count;
} else {
count = 0;
}
}
// increment
count++;
// save to cache
Application[cacheId] = count;
// every 10 counts update the count in the storage / sql
// on high load, increase this to 100 or 1000
if(count % 10 == 0) {
// you'll have to figure this out yourself - see docs link below
App.Data.Update(...);
}