473,513 Members | 13,099 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

clear OutputCache VaryByParam using code?

When displaying a database driven product page, I cache the page using:

<%@ OutputCache Duration="86400" VaryByParam="ProductID" %>

which works fine UNLESS I change the pricing or description for that page in the
database.

Then, I need to clear the cache (either for that specific productID- or for the
aspx page and all the ProductID's it displays).

How can I clear the cache under program control?
--
Thanks in advance, Les Caudle
Nov 18 '05 #1
2 2927
Yes, I realize that - but that is not a good solution.

As the data on the page is tied to a database, I need a way to automatically
clear this cache when the database has changed.

By automatically, I mean using code, not modifying a page by hand in an editor -
or even changing the timestamp on the file (which requires certain permissions)

Somewhere inside of .NET, this cache lives - and there must be a way to clear
it..

Regards, Les Caudle

On Fri, 25 Jun 2004 08:50:10 -0700, "sunshine"
<su******@discussions.microsoft.com> wrote:
I don't know it this is a proper way to do it, but I found that when I alter the page and resave it (you can just type anything and undo it for the sake of saving), the cache starts from fresh again...

"Les Caudle" wrote:
When displaying a database driven product page, I cache the page using:

<%@ OutputCache Duration="86400" VaryByParam="ProductID" %>

which works fine UNLESS I change the pricing or description for that page in the
database.

Then, I need to clear the cache (either for that specific productID- or for the
aspx page and all the ProductID's it displays).

How can I clear the cache under program control?
--
Thanks in advance, Les Caudle


Nov 18 '05 #2
What you're talking about is database dependency.... Asp.net does not support this natively unless your db is file based (it supports file dedendencies). But it can be done. Refer to: http://www.gotdotnet.com/team/rhoward/

"Les Caudle" wrote:
Yes, I realize that - but that is not a good solution.

As the data on the page is tied to a database, I need a way to automatically
clear this cache when the database has changed.

By automatically, I mean using code, not modifying a page by hand in an editor -
or even changing the timestamp on the file (which requires certain permissions)

Somewhere inside of .NET, this cache lives - and there must be a way to clear
it..

Regards, Les Caudle

On Fri, 25 Jun 2004 08:50:10 -0700, "sunshine"
<su******@discussions.microsoft.com> wrote:
I don't know it this is a proper way to do it, but I found that when I alter the page and resave it (you can just type anything and undo it for the sake of saving), the cache starts from fresh again...

"Les Caudle" wrote:
When displaying a database driven product page, I cache the page using:

<%@ OutputCache Duration="86400" VaryByParam="ProductID" %>

which works fine UNLESS I change the pricing or description for that page in the
database.

Then, I need to clear the cache (either for that specific productID- or for the
aspx page and all the ProductID's it displays).

How can I clear the cache under program control?
--
Thanks in advance, Les Caudle


Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2261
by: marshal | last post by:
Hi to All, I am using <% @ OutputCache Duration="60" VaryByParam="none" %> in my usercontrol say "myControl.ascx". This user control has a property say "title". Now am Dynamically Loading...
6
2731
by: Tom Kiefer | last post by:
Question: If I have an ASP.NET User Control which defines/exposes a property that the page can use to specify a mode or data subset for the control to use, is there a way to tell the @OutputCache...
0
295
by: Vassilis T. via .NET 247 | last post by:
The following piece of code, when on a heavily loaded server (more than 50 ASP.NET pages, most using outputcache with varybyparam, lots of users), will only cache the string - the output is not...
5
4620
by: z. f. | last post by:
sorry about the previous post, by mistake not completed. i have an asp.net page with the line <%@ OutputCache Duration="30" VaryByParam="none" %> but when i make requests to the page with...
1
2084
by: Sudhir Sharma | last post by:
guys, I have this code in my .aspx file. <%@ OutputCache Duration="500" VaryByCustom="OrganizationID" VaryByParam="None" %> and I have overriden the method "GetVaryByCustonString()" in my...
1
1261
by: Amil Hanish | last post by:
I had an aspx page with output caching turned on. Then I wanted to do some other stuff and I commented it out like: <!-- <%@ OutputCache Duration="1800" VaryByParam="t" %> --> The IDE...
5
2147
by: Arpan | last post by:
I am using the following code to cache the page output for 60 seconds: <%@ OutputCache Duration="60" VaryByParam="*" %> <script runat="server"> Sub Page_Load(ByVal obj As Object, ByVal ea As...
3
2998
by: craigkenisston | last post by:
Hi, I have some controls with these: <%@ OutputCache Duration="500" Shared="true" VaryByParam="None" %> However, I need that under certain user action, specifically, changing a value on a...
1
4865
by: Nalaka | last post by:
I had ..... <%@ OutputCache Duration="5000" Location="Server" VaryByParam="none" %> Then I added "browser" <%@ OutputCache Duration="5000" Location="Server" VaryByParam="none"...
0
7254
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7153
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7373
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7094
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7519
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5677
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3218
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1585
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
796
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.