Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Caching / October 2005

Tip: Looking for answers? Try searching our database.

prevent output caching when xml request times out?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Andy_S - 30 Sep 2005 22:21 GMT
I have a user control which makes a System.Net.Webrequest to get weather data
from a rather low-performance XML feed.  It times out peridically, which puts
a blank page in the cache until the next time the cache expires.  I figure
there has to be an easy way to detect whether I got data from the XML feed,
and if not, keep the previously cached (though somewhat outdated) older data
until such time as the XML source is responding again.  Currently, I am
implementing the caching via a directive in the ascx file:
<%@ OutputCache Duration="600" VaryByParam="none" %>
Can I get the desired behavior by simply changing parameters here, or do I
have to implement caching programmatically instead, or ???
Venkat_KL - 07 Oct 2005 07:05 GMT
Dear Andy_S,

You can use Cache Dependency for your problem.

ASP.NET allows you to define the validity of a cached item, based on an
external file, a directory, or another cached item.

These are called file dependencies and key dependencies.

If a dependency changes, the cached item is invalidated and removed from
the Cache. You can use this technique to remove items from the Cache when
their data source changes. For example, if you write an application that
processes financial data from an XML file and renders it in a graph, you can
insert the data from the file in the Cache and maintain a dependency on that
XML file. When the file is updated, the item is removed from the cache, your
application rereads the file, and a new version of the item is inserted.

Note   The Cache has no information about the content of the items it
contains. It merely holds a reference to those objects. It also provides
methods to track their dependencies and set expiration policies.

go through these links

INFO: ASP.NET Caching Overview
=====================
http://support.microsoft.com/kb/307225/EN-US/

Caching Application Data
===============
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cp
concacheapis.asp


CacheDependency Class
==============
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlr
fSystemWebCachingCacheDependencyClassTopic.asp


CacheDependency Members
=================
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlr
fsystemwebcachingcachedependencymemberstopic.asp


bye
Venkat_KL

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.