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);
     }
 }
 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;
        }