/// <summary> /// 获得子版块列表 /// </summary> /// <param name="fid">版块id</param> /// <param name="colcount">每行显示几个版块</param> /// <param name="hideprivate">是否显示无权限的版块</param> /// <param name="usergroupid">用户组id</param> /// <param name="moderstyle">版主显示样式</param> /// <returns></returns> public static Discuz.Common.Generic.List <IndexPageForumInfo> GetSubForumCollection(int fid, int colcount, int hideprivate, int usergroupid, int moderstyle) { Discuz.Common.Generic.List <IndexPageForumInfo> coll = new Discuz.Common.Generic.List <IndexPageForumInfo>(); if (fid > 0) { coll = Discuz.Data.Forums.GetSubForumList(fid, colcount); foreach (IndexPageForumInfo info in coll) { info.Description = UBB.ParseSimpleUBB(info.Description); //替换版块介绍中的UBB info.Moderators = GetModerators(info, moderstyle); if (Utils.StrIsNullOrEmpty(info.Lastpost) || (TypeConverter.StrToDateTime(info.Lastpost).ToString("yyyy-MM-dd") != DateTime.Now.ToString("yyyy-MM-dd"))) { info.Todayposts = 0; } //判断是否为私密论坛 if (!Utils.StrIsNullOrEmpty(info.Viewperm) && !Utils.InArray(usergroupid.ToString(), info.Viewperm)) { //hideprivate:0为显示 1为不显示 if (hideprivate == 0) { info.Lasttitle = ""; info.Lastposter = ""; info.Status = -1; } } } } return(coll); }
/// <summary> /// 复制主题 /// </summary> /// <param name="topiclist">主题id列表</param> /// <param name="fid">目标版块id</param> /// <returns>更新记录数</returns> public static int CopyTopics(string topiclist, int fid) { if (!Utils.IsNumericList(topiclist)) { return(-1); } int tid; int reval = 0; TopicInfo topicinfo = null; foreach (string topicid in topiclist.Split(',')) { topicinfo = Topics.GetTopicInfo(TypeConverter.StrToInt(topicid)); if (topicinfo != null) { topicinfo.Fid = fid; topicinfo.Readperm = 0; topicinfo.Price = 0; topicinfo.Postdatetime = Utils.GetDateTime(); topicinfo.Lastpost = Utils.GetDateTime(); topicinfo.Lastposter = Utils.GetDateTime(); topicinfo.Views = 0; topicinfo.Replies = 0; topicinfo.Displayorder = 0; topicinfo.Highlight = ""; topicinfo.Digest = 0; topicinfo.Rate = 0; topicinfo.Hide = 0; topicinfo.Special = 0; topicinfo.Attachment = 0; topicinfo.Moderated = 0; topicinfo.Closed = 0; tid = Topics.CreateTopic(topicinfo); if (tid > 0) { PostInfo postinfo = Posts.GetPostInfo(tid, Posts.GetFirstPostId(TypeConverter.StrToInt(topicid))); postinfo.Fid = topicinfo.Fid; postinfo.Tid = tid; postinfo.Parentid = 0; postinfo.Layer = 0; postinfo.Postdatetime = Utils.GetDateTime(); postinfo.Invisible = 0; postinfo.Attachment = 0; postinfo.Rate = 0; postinfo.Ratetimes = 0; postinfo.Message = UBB.ClearAttachUBB(postinfo.Message); postinfo.Topictitle = topicinfo.Title; if (Posts.CreatePost(postinfo) > 0) { reval++; } } } } return(reval); }
public static bool PushFeedToDiscuzCloud(TopicInfo topic, PostInfo post, AttachmentInfo[] attachments, UserConnect connectInfo, string ip, string rootUrl) { DiscuzCloudConfigInfo config = DiscuzCloudConfigInfo.Current; List <DiscuzOAuthParameter> list = new List <DiscuzOAuthParameter>(); list.Add(new DiscuzOAuthParameter("client_ip", ip)); list.Add(new DiscuzOAuthParameter("thread_id", topic.Tid.ToString())); list.Add(new DiscuzOAuthParameter("author_id", topic.Posterid.ToString())); list.Add(new DiscuzOAuthParameter("author", topic.Poster)); list.Add(new DiscuzOAuthParameter("forum_id", topic.Fid.ToString())); list.Add(new DiscuzOAuthParameter("p_id", post.Pid.ToString())); list.Add(new DiscuzOAuthParameter("subject", topic.Title)); GeneralConfigInfo config2 = GeneralConfigInfo.Current; list.Add(new DiscuzOAuthParameter("html_content", UBB.UBBToHTML(new PostpramsInfo { Sdetail = post.Message, Smiliesinfo = Smilies.GetSmiliesListWithInfo(), Bbcodemode = config2.Bbcodemode, Parseurloff = post.Parseurloff, BBCode = post.Bbcodeoff < 1, Signature = 0, Allowhtml = post.Htmlon, Pid = post.Pid, Showimages = 1 - post.Smileyoff, Smileyoff = post.Smileyoff, Smiliesmax = config2.Smiliesmax, Hide = 0 }))); list.Add(new DiscuzOAuthParameter("bbcode_content", post.Message)); list.Add(new DiscuzOAuthParameter("read_permission", "0")); list.Add(new DiscuzOAuthParameter("u_id", topic.Posterid.ToString())); list.Add(new DiscuzOAuthParameter("f_type", TypeConverter.BooleanToIntString(connectInfo.AllowPushFeed))); StringBuilder stringBuilder = new StringBuilder(); int num = 0; if (attachments != null) { for (int i = 0; i < attachments.Length; i++) { AttachmentInfo attachmentInfo = attachments[i]; if (num < 3 && attachmentInfo.Filetype.IndexOf("image") > -1 && attachmentInfo.Attachprice <= 0) { stringBuilder.AppendFormat("|{0}upload/{1}", rootUrl, attachmentInfo.Filename.Replace("\\", "/")); num++; } } } list.Add(new DiscuzOAuthParameter("attach_images", stringBuilder.ToString().TrimStart('|'))); DiscuzOAuth discuzOAuth = new DiscuzOAuth(); string postData = ""; string oAuthUrl = discuzOAuth.GetOAuthUrl(API_CONNECT_URL + "connect/feed/new", "POST", config.Connectappid, config.Connectappkey, connectInfo.Token, connectInfo.Secret, "", "", list, out postData); Utils.GetHttpWebResponse(oAuthUrl, postData); return(true); }
/// <summary> /// 更新用户全部信息 /// </summary> /// <param name="__userinfo"></param> /// <returns></returns> public static bool UpdateUserAllInfo(UserInfo userInfo) { Users.UpdateUser(userInfo); //当用户不是版主(超级版主)或管理员 if ((userInfo.Adminid == 0) || (userInfo.Adminid > 3)) { //删除用户在版主列表中相关数据 Data.Moderators.DeleteModerator(userInfo.Uid); //同时更新版块相关的版主信息 UpdateForumsFieldModerators(userInfo.Username); } else { DNTCache cache = DNTCache.GetCacheService(); cache.RemoveObject("/Forum/AdminUsers"); } #region 以下为更新该用户的扩展信息 string signature = Utils.HtmlEncode(ForumUtils.BanWordFilter(userInfo.Signature)); UserGroupInfo usergroupinfo = AdminUserGroups.AdminGetUserGroupInfo(userInfo.Groupid); GeneralConfigInfo config = GeneralConfigs.GetConfig(); PostpramsInfo postPramsInfo = new PostpramsInfo(); postPramsInfo.Usergroupid = usergroupinfo.Groupid; postPramsInfo.Attachimgpost = config.Attachimgpost; postPramsInfo.Showattachmentpath = config.Showattachmentpath; postPramsInfo.Hide = 0; postPramsInfo.Price = 0; postPramsInfo.Sdetail = userInfo.Signature; postPramsInfo.Smileyoff = 1; postPramsInfo.Bbcodeoff = 1 - usergroupinfo.Allowsigbbcode; postPramsInfo.Parseurloff = 1; postPramsInfo.Showimages = usergroupinfo.Allowsigimgcode; postPramsInfo.Allowhtml = 0; postPramsInfo.Smiliesinfo = Smilies.GetSmiliesListWithInfo(); postPramsInfo.Customeditorbuttoninfo = Editors.GetCustomEditButtonListWithInfo(); postPramsInfo.Smiliesmax = config.Smiliesmax; postPramsInfo.Signature = 1; postPramsInfo.Onlinetimeout = config.Onlinetimeout; userInfo.Signature = signature; userInfo.Authstr = ForumUtils.CreateAuthStr(20); userInfo.Sightml = UBB.UBBToHTML(postPramsInfo); Users.UpdateUser(userInfo); #endregion Users.UpdateUserForumSetting(userInfo); return(true); }
/// <summary> /// 更新用户全部信息 /// </summary> /// <param name="__userinfo"></param> /// <returns></returns> public static bool UpdateUserAllInfo(UserInfo __userinfo) { DatabaseProvider.GetInstance().UpdateUserAllInfo(__userinfo); //当用户不是版主(超级版主)或管理员 if ((__userinfo.Adminid == 0) || (__userinfo.Adminid > 3)) { //删除用户在版主列表中相关数据 DatabaseProvider.GetInstance().DeleteModerator(__userinfo.Uid); //同时更新版块相关的版主信息 UpdateForumsFieldModerators(__userinfo.Username); } #region 以下为更新该用户的扩展信息 string signature = Utils.HtmlEncode(ForumUtils.BanWordFilter(__userinfo.Signature)); UserGroupInfo usergroupinfo = AdminUserGroups.AdminGetUserGroupInfo(__userinfo.Groupid); GeneralConfigInfo config = GeneralConfigs.GetConfig(); PostpramsInfo _postpramsinfo = new PostpramsInfo(); _postpramsinfo.Usergroupid = usergroupinfo.Groupid; _postpramsinfo.Attachimgpost = config.Attachimgpost; _postpramsinfo.Showattachmentpath = config.Showattachmentpath; _postpramsinfo.Hide = 0; _postpramsinfo.Price = 0; _postpramsinfo.Sdetail = __userinfo.Signature; _postpramsinfo.Smileyoff = 1; _postpramsinfo.Bbcodeoff = 1 - usergroupinfo.Allowsigbbcode; _postpramsinfo.Parseurloff = 1; _postpramsinfo.Showimages = usergroupinfo.Allowsigimgcode; _postpramsinfo.Allowhtml = 0; _postpramsinfo.Smiliesinfo = Smilies.GetSmiliesListWithInfo(); _postpramsinfo.Customeditorbuttoninfo = Editors.GetCustomEditButtonListWithInfo(); _postpramsinfo.Smiliesmax = config.Smiliesmax; _postpramsinfo.Signature = 1; _postpramsinfo.Onlinetimeout = config.Onlinetimeout; DatabaseProvider.GetInstance().UpdateUserField(__userinfo, signature, ForumUtils.CreateAuthStr(20), UBB.UBBToHTML(_postpramsinfo)); #endregion Users.UpdateUserForumSetting(__userinfo); return(true); }
/// <summary> /// 发送feed请求到云平台 /// </summary> /// <param name="topic"></param> /// <param name="post"></param> /// <param name="attachments"></param> /// <param name="connectInfo"></param> /// <returns></returns> public static bool PushFeedToDiscuzCloud(TopicInfo topic, PostInfo post, AttachmentInfo[] attachments, UserConnectInfo connectInfo, string ip, string rootUrl) { DiscuzCloudConfigInfo config = DiscuzCloudConfigs.GetConfig(); List <DiscuzOAuthParameter> parmlist = new List <DiscuzOAuthParameter>(); parmlist.Add(new DiscuzOAuthParameter("client_ip", ip)); parmlist.Add(new DiscuzOAuthParameter("thread_id", topic.Tid.ToString())); parmlist.Add(new DiscuzOAuthParameter("author_id", topic.Posterid.ToString())); parmlist.Add(new DiscuzOAuthParameter("author", topic.Poster)); parmlist.Add(new DiscuzOAuthParameter("forum_id", topic.Fid.ToString())); parmlist.Add(new DiscuzOAuthParameter("p_id", post.Pid.ToString())); parmlist.Add(new DiscuzOAuthParameter("subject", topic.Title)); #region 构造postparmsinfo GeneralConfigInfo generalConfig = GeneralConfigs.GetConfig(); PostpramsInfo postpramsInfo = new PostpramsInfo(); postpramsInfo.Sdetail = post.Message; postpramsInfo.Smiliesinfo = Smilies.GetSmiliesListWithInfo(); postpramsInfo.Bbcodemode = generalConfig.Bbcodemode; postpramsInfo.Parseurloff = post.Parseurloff; postpramsInfo.Bbcodeoff = post.Bbcodeoff; postpramsInfo.Signature = 0; postpramsInfo.Allowhtml = post.Htmlon; postpramsInfo.Pid = post.Pid; postpramsInfo.Showimages = 1 - post.Smileyoff; postpramsInfo.Smileyoff = post.Smileyoff; postpramsInfo.Smiliesmax = generalConfig.Smiliesmax; //判断是否为回复可见帖, hide=0为不解析[hide]标签, hide>0解析为回复可见字样, hide=-1解析为以下内容回复可见字样显示真实内容 //将逻辑判断放入取列表的循环中处理,此处只做是否为回复人的判断,主题作者也该可见 postpramsInfo.Hide = 0; #endregion parmlist.Add(new DiscuzOAuthParameter("html_content", UBB.UBBToHTML(postpramsInfo))); parmlist.Add(new DiscuzOAuthParameter("bbcode_content", post.Message)); parmlist.Add(new DiscuzOAuthParameter("read_permission", "0")); parmlist.Add(new DiscuzOAuthParameter("u_id", topic.Posterid.ToString())); parmlist.Add(new DiscuzOAuthParameter("f_type", connectInfo.AllowPushFeed.ToString())); StringBuilder attachUrlList = new StringBuilder(); int attachCount = 0; if (attachments != null) { foreach (AttachmentInfo info in attachments) { if (attachCount < 3 && info.Filetype.IndexOf("image") > -1 && info.Attachprice <= 0) { attachUrlList.AppendFormat("|{0}upload/{1}", rootUrl, info.Filename.Replace("\\", "/")); attachCount++; } } } parmlist.Add(new DiscuzOAuthParameter("attach_images", attachUrlList.ToString().TrimStart('|'))); DiscuzOAuth oAuth = new DiscuzOAuth(); string queryStr = ""; string feedUrl = oAuth.GetOAuthUrl(API_CONNECT_URL + "connect/feed/new", "POST", config.Connectappid, config.Connectappkey, connectInfo.Token, connectInfo.Secret, "", "", parmlist, out queryStr); Utils.GetHttpWebResponse(feedUrl, queryStr); return(true); }
/// <summary> /// 获得论坛最新的20个主题的Rss描述 /// </summary> /// <param name="ttl">TTL数值</param> /// <returns>Rss描述</returns> public static string GetRssXml(int ttl) { Discuz.Cache.DNTCache cache = Discuz.Cache.DNTCache.GetCacheService(); string str = cache.RetrieveObject("/RSS/Index") as string; if (str != null) { return(str); } ForumInfo[] forumlist = Forums.GetForumList(); UserGroupInfo guestinfo = UserGroups.GetUserGroupInfo(7); StringBuilder sbforumlist = new StringBuilder(); //不允许游客访问的板块Id列表 StringBuilder sbRss = new StringBuilder("<?xml version=\"1.0\" encoding=\"utf-8\" ?>\r\n"); foreach (ForumInfo f in forumlist) { if (f.Allowrss == 0) { sbforumlist.AppendFormat(",{0}", f.Fid); } else { if (f.Viewperm == null || f.Viewperm == string.Empty) { //板块权限设置为空,按照用户组权限走,RSS仅检查游客权限 if (guestinfo.Allowvisit == 0) { sbforumlist.AppendFormat(",{0}", f.Fid); } } else { if (!Utils.InArray("7", f.Viewperm, ",")) { sbforumlist.AppendFormat(",{0}", f.Fid); } } } } if (sbforumlist.Length > 0) { sbforumlist.Remove(0, 1); } string forumurl = "http://" + DNTRequest.GetCurrentFullHost() + ("/").ToLower(); sbRss.Append("<?xml-stylesheet type=\"text/xsl\" href=\"rss.xsl\" media=\"screen\"?>\r\n"); sbRss.Append("<rss version=\"2.0\">\r\n"); sbRss.Append(" <channel>\r\n"); sbRss.Append(" <title>"); sbRss.Append(Utils.HtmlEncode(config.Forumtitle)); sbRss.Append("</title>\r\n"); sbRss.Append(" <link>"); sbRss.Append(forumurl); sbRss.Append("</link>\r\n"); sbRss.Append(" <description>Latest 20 threads</description>\r\n"); sbRss.Append(" <copyright>Copyright (c) "); sbRss.Append(Utils.HtmlEncode(config.Forumtitle)); sbRss.Append("</copyright>\r\n"); sbRss.Append(" <generator>"); sbRss.Append("Discuz!NT"); sbRss.Append("</generator>\r\n"); sbRss.Append(" <pubDate>"); //sbRss.Append(DateTime.Now.ToUniversalTime().ToString("ddd, dd MMM yyyy HH':'mm':'ss 'GMT'")); sbRss.Append(DateTime.Now.ToString("r")); sbRss.Append("</pubDate>\r\n"); sbRss.AppendFormat(" <ttl>{0}</ttl>\r\n", ttl.ToString()); //声明新的缓存策略接口 Discuz.Cache.ICacheStrategy ics = new RssCacheStrategy(); ics.TimeOut = ttl; cache.LoadCacheStrategy(ics); IDataReader reader = DatabaseProvider.GetInstance().GetNewTopics(sbforumlist.ToString()); if (reader != null) { while (reader.Read()) { sbRss.Append(" <item>\r\n"); sbRss.Append(" <title>"); sbRss.Append(Utils.HtmlEncode(reader["title"].ToString().Trim())); sbRss.Append("</title>\r\n"); sbRss.Append(" <description><![CDATA["); if (reader["message"].ToString().IndexOf("[hide]") > -1) { sbRss.Append("***内容隐藏***"); } else { sbRss.Append(Utils.HtmlEncode(Utils.GetSubString(UBB.ClearUBB(reader["message"].ToString()), 200, "......"))); } sbRss.Append("]]></description>\r\n"); sbRss.Append(" <link>"); sbRss.Append(Utils.HtmlEncode(forumurl)); if (config.Aspxrewrite == 1) { sbRss.Append("showtopic-"); sbRss.Append(reader["tid"].ToString()); sbRss.Append(config.Extname); } else { sbRss.Append("showtopic.aspx?topicid="); sbRss.Append(reader["tid"].ToString()); } sbRss.Append("</link>\r\n"); sbRss.Append(" <category>"); sbRss.Append(Utils.HtmlEncode(reader["name"].ToString().Trim())); sbRss.Append("</category>\r\n"); sbRss.Append(" <author>"); sbRss.Append(Utils.HtmlEncode(reader["poster"].ToString().Trim())); sbRss.Append("</author>\r\n"); sbRss.Append(" <pubDate>"); sbRss.Append(Utils.HtmlEncode(Convert.ToDateTime(reader["postdatetime"]).ToString("r").Trim())); sbRss.Append("</pubDate>\r\n"); sbRss.Append(" </item>\r\n"); } reader.Close(); } else { sbRss.Length = 0; sbRss.Append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n"); sbRss.Append("<Rss>Error</Rss>\r\n"); cache.AddObject("/RSS/Index", sbRss.ToString()); cache.LoadDefaultCacheStrategy(); return(sbRss.ToString()); } sbRss.Append(" </channel>\r\n"); sbRss.Append("</rss>"); cache.AddObject("/RSS/Index", sbRss.ToString()); cache.LoadDefaultCacheStrategy(); return(sbRss.ToString()); }
/// <summary> /// 获得指定版块最新的20个主题的Rss描述 /// </summary> /// <param name="ttl">TTL数值</param> /// <param name="fid">版块id</param> /// <returns>Rss描述</returns> public static string GetForumRssXml(int ttl, int fid) { Discuz.Cache.DNTCache cache = Discuz.Cache.DNTCache.GetCacheService(); string str = cache.RetrieveObject("/RSS/Forum" + fid) as string; if (str != null) { return(str); } string forumurl = "http://" + DNTRequest.GetCurrentFullHost() + ("/").ToLower();//GeneralConfigs.GetConfig().Forumurl; //if (!forumurl.EndsWith("/")) //{ // forumurl = forumurl + "/"; //} ForumInfo forum = Forums.GetForumInfo(fid); if (forum == null) { return("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<Rss>Specified forum not found</Rss>\r\n"); } if (forum.Viewperm == null || forum.Viewperm == string.Empty) { //板块权限设置为空,按照用户组权限走,RSS仅检查游客权限 UserGroupInfo guestinfo = UserGroups.GetUserGroupInfo(7); if (guestinfo.Allowvisit == 0) { return("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<Rss>Guest Denied</Rss>\r\n"); } } else { if (!Utils.InArray("7", forum.Viewperm, ",")) { return("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<Rss>Guest Denied</Rss>\r\n"); } } StringBuilder sbRss = new StringBuilder("<?xml version=\"1.0\" encoding=\"utf-8\" ?>\r\n"); sbRss.Append("<?xml-stylesheet type=\"text/xsl\" href=\"rss.xsl\" media=\"screen\"?>\r\n"); sbRss.Append("<rss version=\"2.0\">\r\n"); sbRss.Append(" <channel>\r\n"); sbRss.Append(" <title>"); sbRss.Append(Utils.HtmlEncode(config.Forumtitle)); sbRss.Append(" - "); sbRss.Append(Utils.HtmlEncode(forum.Name)); sbRss.Append("</title>\r\n"); sbRss.Append(" <link>"); sbRss.Append(forumurl); if (config.Aspxrewrite == 1) { sbRss.Append("showforum-"); sbRss.Append(fid.ToString()); sbRss.Append(config.Extname); } else { sbRss.Append("showforum.aspx?forumid="); sbRss.Append(fid.ToString()); } sbRss.Append("</link>\r\n"); sbRss.Append(" <description>Latest 20 threads</description>\r\n"); sbRss.Append(" <copyright>Copyright (c) "); sbRss.Append(Utils.HtmlEncode(config.Forumtitle)); sbRss.Append("</copyright>\r\n"); sbRss.Append(" <generator>"); sbRss.Append("Discuz!NT"); sbRss.Append("</generator>\r\n"); sbRss.Append(" <pubDate>"); //sbRss.Append(DateTime.Now.ToUniversalTime().ToString("ddd, dd MMM yyyy HH':'mm':'ss 'GMT'")); sbRss.Append(DateTime.Now.ToString("r")); sbRss.Append("</pubDate>\r\n"); sbRss.AppendFormat(" <ttl>{0}</ttl>\r\n", ttl.ToString()); IDataReader reader = DatabaseProvider.GetInstance().GetForumNewTopics(fid); if (reader != null) { while (reader.Read()) { sbRss.Append(" <item>\r\n"); sbRss.Append(" <title>"); sbRss.Append(Utils.HtmlEncode(reader["title"].ToString().Trim())); sbRss.Append("</title>\r\n"); sbRss.Append(" <description><![CDATA["); if (reader["message"].ToString().IndexOf("[hide]") > -1) { sbRss.Append("***内容隐藏***"); } else { sbRss.Append(Utils.HtmlEncode(Utils.GetSubString(UBB.ClearUBB(reader["message"].ToString()), 200, "......"))); } sbRss.Append("]]></description>\r\n"); sbRss.Append(" <link>"); sbRss.Append(Utils.HtmlEncode(forumurl)); if (config.Aspxrewrite == 1) { sbRss.Append("showtopic-"); sbRss.Append(reader["tid"].ToString()); sbRss.Append(config.Extname); } else { sbRss.Append("showtopic.aspx?topicid="); sbRss.Append(reader["tid"].ToString()); } sbRss.Append("</link>\r\n"); sbRss.Append(" <category>"); sbRss.Append(Utils.HtmlEncode(forum.Name)); sbRss.Append("</category>\r\n"); sbRss.Append(" <author>"); sbRss.Append(Utils.HtmlEncode(reader["poster"].ToString().Trim())); sbRss.Append("</author>\r\n"); sbRss.Append(" <pubDate>"); sbRss.Append(Utils.HtmlEncode(Convert.ToDateTime(reader["postdatetime"]).ToString("r").Trim())); sbRss.Append("</pubDate>\r\n"); sbRss.Append(" </item>\r\n"); } reader.Close(); } sbRss.Append(" </channel>\r\n"); sbRss.Append("</rss>"); Discuz.Cache.ICacheStrategy ics = new RssCacheStrategy(); ics.TimeOut = ttl; cache.LoadCacheStrategy(ics); cache.AddObject("/RSS/Forum" + fid, sbRss.ToString()); cache.LoadDefaultCacheStrategy(); return(sbRss.ToString()); }