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 / May 2004

Tip: Looking for answers? Try searching our database.

Manually refreshing the Cache

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jay - 06 May 2004 17:04 GMT
I am using Page Output Caching by using:

<%@ OutputCache Duration="6000" VaryByParam="None" Location="Any" %>

I would like to force caching to refresh all pages or specified pages in my website.  I realize there are various ways of setting the time limit, etc. for a cache.  Basically I want some pages to be cached "forever" but I need to be able to manually force a refresh of all pages by running an admin page which executes code that refreshes all pages.  

The only way that I have been able to force a refresh is to stop the website using IIS or reboot the PC.  Even in some cases making a change in the code of the page and recompilijng  did not seem to refresh the cache.

Thanks for you help.

Jay
Anders Borum - 08 May 2004 23:03 GMT
Hello!

If you have a list of the pages to be evicted from the cache (such as a
hierarchical tree representing the navigation structure), you could do a
iteration on top of that and evict the pages explicitly one by one.

The ASP.NET framework allows for eviction of cached pages programatically!

Signature

venlig hilsen / with regards
anders borum
--

Jay - 10 May 2004 04:51 GMT
Thanks, but I need a little more help than this.

I am thinking that there are two steps I need to do.

1) Determine what subclasses of System.Web.UI.Page are in my project using reflection.
2) For each subclass refresh the output page cache.

I do not know how to do either of these steps.

If I have page in my project called Login how do I refresh the output page cache?  The only think I know how to do is something like Page.cache.remove("foo"), which is an instance method that only removes the cached item "foo".  I want to programatically refresh the page output cache for page Login.

How do I determine what subclasses of System.Web.UI.Page are in my project.

Hope this is clear.

Thanks. Jay
Victor _ - 28 May 2004 15:46 GMT
Not sure if this will still help you or not but I was looking to do
something similar.  I have a page with 3 user controls on it.  Each of
the user controls are cached but I wanted to force a refresh on each
user control independently.  Here is what I did:
1) Added varybyparam="rptRefresh" to <%@ OutputCache duration="100"
varybyparam="rptRefresh" %>
2) Added a button to the page where the user control is included.  When
this button is clicked I redirect to the same page but set a parameter
on the query string called rptRefresh equal to anything.  This forces
the user control to refresh.  Any time rptRefresh changes values on the
query string the user control will refresh.

Hope this helps.

By the way, I noticed varybycontrol is similar (but references a
control), however, I read this requires overriding before it will work.

--Victor

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.