The CachedFeed is a cacheable container for our rss feed(s). Instead of requesting the cache data, processing it, and creating an XML document on each request, we will store the actual Rss document as a cached string. Generally, it will be returned to the client by calling Response.Write(feed.Xml)

Exemple #1
0
 protected override void Cache(CachedFeed feed)
 {
     ICache cache = SubtextContext.Cache;
     if(cache != null)
     {
         cache.InsertDuration(CacheKey(SyndicationWriter.DateLastViewedFeedItemPublished), feed,
                              Cacher.MediumDuration, null);
     }
 }
        /// <summary>
        /// Caches the specified RSS feed.
        /// </summary>
        /// <param name="feed">Feed.</param>
        protected override void Cache(CachedFeed feed)
        {
            ICache cache = SubtextContext.Cache;

            if (cache != null)
            {
                cache.InsertDuration(CacheKey(SyndicationWriter.DateLastViewedFeedItemPublished), feed,
                                     Cacher.MediumDuration, null);
            }
        }
Exemple #3
0
        /// <summary>
        /// Builds the feed using delta encoding if it's true.
        /// </summary>
        /// <returns></returns>
        protected override CachedFeed BuildFeed()
        {
            _comments = GetFeedEntries() ?? new List <FeedbackItem>();

            var feed             = new CachedFeed();
            CommentRssWriter crw = GetCommentWriter(_comments, ParentEntry);

            feed.LastModified = _comments.Count > 0 ? ConvertLastUpdatedDate(_comments.Last().DateCreated) : ParentEntry.DateCreated;
            feed.Xml          = crw.Xml;
            return(feed);
        }
Exemple #4
0
        protected virtual CachedFeed BuildFeed()
        {
            var feed = new CachedFeed {
                LastModifiedUtc = Blog.DateModifiedUtc
            };
            BaseSyndicationWriter writer = SyndicationWriter;

            feed.Xml = writer.Xml;
            feed.ClientHasAllFeedItems = writer.ClientHasAllFeedItems;
            feed.Etag = writer.DateLastViewedFeedItemPublishedUtc.ToString(CultureInfo.InvariantCulture);
            feed.LatestFeedItemPublishDate = writer.DateLastViewedFeedItemPublishedUtc;

            return(feed);
        }
Exemple #5
0
        /// <summary>
        /// Builds the feed using delta encoding if it's true.
        /// </summary>
        /// <returns></returns>
        protected override CachedFeed BuildFeed()
        {
            CachedFeed feed = null;

            _posts = GetFeedEntries();

            if (_posts != null && _posts.Count > 0)
            {
                feed = new CachedFeed();
                var cw = new CategoryWriter(new StringWriter(), _posts, Category,
                                            Url.CategoryUrl(Category).ToFullyQualifiedUrl(Blog), SubtextContext);
                feed.LastModifiedUtc = _posts.First().DateCreatedUtc;
                feed.Xml             = cw.Xml;
            }
            return(feed);
        }
Exemple #6
0
        /// <summary>
        /// Builds the feed using delta encoding if it's true.
        /// </summary>
        /// <returns></returns>
        protected override CachedFeed BuildFeed()
        {
            CachedFeed feed = null;

            _posts = GetFeedEntries();

            if (_posts != null && _posts.Count > 0)
            {
                feed = new CachedFeed();
                var cw = new CategoryWriter(HttpContext.Response.Output, _posts, Category,
                                            Url.CategoryUrl(Category).ToFullyQualifiedUrl(Blog), SubtextContext);
                feed.LastModified = ConvertLastUpdatedDate(_posts.First().DateCreated);
                feed.Xml          = cw.Xml;
            }
            return(feed);
        }
Exemple #7
0
 protected abstract void Cache(CachedFeed feed);
 protected override void Cache(CachedFeed feed)
 {
 }
 protected abstract void Cache(CachedFeed feed);
        protected virtual CachedFeed BuildFeed()
        {
            var feed = new CachedFeed { LastModifiedUtc = Blog.DateModifiedUtc };
            BaseSyndicationWriter writer = SyndicationWriter;
            feed.Xml = writer.Xml;
            feed.ClientHasAllFeedItems = writer.ClientHasAllFeedItems;
            feed.Etag = writer.DateLastViewedFeedItemPublishedUtc.ToString(CultureInfo.InvariantCulture);
            feed.LatestFeedItemPublishDate = writer.DateLastViewedFeedItemPublishedUtc;

            return feed;
        }