CachedFeed.cs :  » Bloggers » SubText » Subtext » Framework » Syndication » C# / CSharp Open Source

Home
C# / CSharp Open Source
1.2.6.4 mono .net core
2.2.6.4 mono core
3.Aspect Oriented Frameworks
4.Bloggers
5.Build Systems
6.Business Application
7.Charting Reporting Tools
8.Chat Servers
9.Code Coverage Tools
10.Content Management Systems CMS
11.CRM ERP
12.Database
13.Development
14.Email
15.Forum
16.Game
17.GIS
18.GUI
19.IDEs
20.Installers Generators
21.Inversion of Control Dependency Injection
22.Issue Tracking
23.Logging Tools
24.Message
25.Mobile
26.Network Clients
27.Network Servers
28.Office
29.PDF
30.Persistence Frameworks
31.Portals
32.Profilers
33.Project Management
34.RSS RDF
35.Rule Engines
36.Script
37.Search Engines
38.Sound Audio
39.Source Control
40.SQL Clients
41.Template Engines
42.Testing
43.UML
44.Web Frameworks
45.Web Service
46.Web Testing
47.Wiki Engines
48.Windows Presentation Foundation
49.Workflows
50.XML Parsers
C# / C Sharp
C# / C Sharp by API
C# / CSharp Tutorial
C# / CSharp Open Source » Bloggers » SubText 
SubText » Subtext » Framework » Syndication » CachedFeed.cs
#region Disclaimer/Info

///////////////////////////////////////////////////////////////////////////////////////////////////
// Subtext WebLog
// 
// Subtext is an open source weblog system that is a fork of the .TEXT
// weblog system.
//
// For updated news and information please visit http://subtextproject.com/
// Subtext is hosted at Google Code at http://code.google.com/p/subtext/
// The development mailing list is at subtext@googlegroups.com 
//
// This project is licensed under the BSD license.  See the License.txt file for more information.
///////////////////////////////////////////////////////////////////////////////////////////////////

#endregion

using System;
using System.Globalization;

namespace Subtext.Framework.Syndication{
    /// <summary>
    /// <p>
    /// 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)
    /// </p>
    /// </summary>
    public class CachedFeed
    {
        private string _etag;
        private DateTime _lastModified;

        public CachedFeed()
        {
            LatestFeedItemPublishDate = NullValue.NullDateTime;
        }

        /// <summary>
        /// Gets or sets the date this feed was last modified.
        /// </summary>
        /// <value></value>
        public DateTime LastModified
        {
            //TODO: Need to figure out what happens to the date when we set LastModified date. 
            // Returned data usually does not match 
            // what we sent!
            get { return _lastModified; }
            set
            {
                //Just incase the user changes timezones after a post
                if(value > DateTime.Now)
                {
                    value = DateTime.Now;
                }
                _lastModified = value;
            }
        }

        /// <summary>
        /// Gets or sets a value indicating whether client has all feed items. 
        /// This is according to RFC3229 with feeds 
        /// <see href="http://bobwyman.pubsub.com/main/2004/09/using_rfc3229_w.html"/>.
        /// </summary>
        /// <value>
        ///   <c>true</c> if the client has all feed items; otherwise, <c>false</c>.
        /// </value>
        public bool ClientHasAllFeedItems { get; set; }

        /// <summary>
        /// Gets or sets the latest feed item publish date. This is the date that the latest feed 
        /// item that will be sent to the client was published.
        /// </summary>
        /// <value></value>
        public DateTime LatestFeedItemPublishDate { get; set; }

        /// <summary>
        /// Provides the current value of the entity tag for the requested 
        /// variant (<see href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.19"/>). 
        /// In our case, it should be the ID of the last feed item sent.
        /// </summary>
        /// <value></value>
        public string Etag
        {
            get
            {
                if(_etag == null)
                {
                    // if we did not set the etag, just use the 
                    // LastModified Date
                    _etag = LastModified.ToString(CultureInfo.InvariantCulture);
                }
                return _etag;
            }
            set { _etag = value; }
        }

        /// <summary>
        /// Gets or sets the contents of the feed.
        /// </summary>
        /// <value></value>
        public string Xml { get; set; }
    }
}
www.java2v.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.