protected PostCollection GetTaggedPosts(string tagName) { PostCollection pc = ZCache.Get <PostCollection>("Tags-ForRSS-" + tagName); if (pc == null) { pc = Post.FetchPostsByTag(TagName); PostCollection permissionsFiltered = new PostCollection(); foreach (Post post in pc) { permissionsFiltered.Add(post); } permissionsFiltered.AddRange(pc); foreach (Post p in pc) { if (!RolePermissionManager.GetPermissions(p.Category.Id, GraffitiUsers.Current).Read) { permissionsFiltered.Remove(p); } } pc.Clear(); int ctr = 0; foreach (Post post in permissionsFiltered) { if (ctr < Util.PageSize) { pc.Add(post); ctr++; } } ZCache.InsertCache("Tags-ForRSS-" + tagName, pc, 120); } return(pc); }
/// <summary> /// Gets all Posts by the specified tag /// </summary> /// <param name="tagName"></param> /// <returns></returns> public PostCollection PostsByTag(string tagName) { string TagName = Util.CleanForUrl(tagName); PostCollection pc = ZCache.Get <PostCollection>("Tags-" + TagName); if (pc == null) { pc = Post.FetchPostsByTag(TagName); ZCache.InsertCache("Tags-" + TagName, pc, 60); } return(pc); }