コード例 #1
0
ファイル: Handler.ashx.cs プロジェクト: avasay/RSSCaching
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/xml";

            RSSCacher rssCacher = new RSSCacher();
            string    feed      = rssCacher.GetFeed(@"https://seekingalpha.com/market_currents.xml");

            context.Response.Write(feed);
        }
コード例 #2
0
ファイル: RSSData.cs プロジェクト: avasay/RSSCaching
 /// <summary>
 /// UpdateCache calls the HttpRuntime Cache method to insert data into
 /// the application cache, provides the policy for expiration, and
 /// the associated callback when it expires.
 /// </summary>
 /// <param name="sender"></param>
 public void UpdateCache(RSSCacher sender)
 {
     try
     {
         HttpRuntime.Cache.Insert(Key,
                                  this,
                                  null,
                                  DateTime.Now.AddSeconds(60),
                                  System.Web.Caching.Cache.NoSlidingExpiration,
                                  CacheItemPriority.Default,
                                  new CacheItemRemovedCallback(sender.RemovedCallback));
     }
     catch (Exception ex)
     {
         Console.WriteLine("Error inserting feed data into cache. " + ex.Message);
     }
 }