.NETGURU
Clearing User Control Cache
Messages   Related Types
This message was discovered on ASPFriends.com 'aspngcache' list.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.

Julian Voelcker
Is there any way to clear the cache so that user controls get
re-loaded? This is only really required during development.

I have been making changes to a user control, but the changes aren't
being seen on the page because the user control is being cached.

Cheers,

Julian Voelcker

Reply to this message...
 
    
Mitch Denny (VIP)
Julian,

Inline is a very simple page that you can save out and drop
onto your server that will walk the list of cached objects
and remove a whole stack of them - some keep coming back
because ASP.NET constantly re-inserts them, but it should
nicely drop your cached server controls without too much hassle.

<%@ Page Language="C#" %>

<html>

    <head>
    
        <title>Clear Cache</title>
        
        <script language="C#" runAt="server">
        
            protected override void OnInit(EventArgs e)
            {
            
                this.Clear.Click += new EventHandler(this.Clear_Click);
            
            }
            
            private void Clear_Click(object sender, EventArgs e)
            {

                foreach (DictionaryEntry entry in this.Cache)
                {
                
                    this.Cache.Remove((string)entry.Key);
                
                }
            
            }
        
        </script>
    
    </head>
    
    <body>
    
        <form runAt="server">
    
            <h1>Clear Cache</h1>

            <asp:button id="Clear" runAt="server" text="Clear!" />

        </form>
    
    </body>

</html>

Hope this helps.

----------------------------------------
- Mitch Denny
- Click here to reveal e-mail address
- +61 (414) 610-141
-

----- Original Message -----
From: Julian Voelcker <Click here to reveal e-mail address>
To: Click here to reveal e-mail address
Sent: Fri, 15 Mar 2002 09:00:35 GMT
Subject: Clearing User Control Cache

Is there any way to clear the cache so that user controls get
re-loaded? This is only really required during development.

I have been making changes to a user control, but the changes aren't
being seen on the page because the user control is being cached.

Cheers,

Julian Voelcker

Reply to this message...
 
    
SimpleTin
The best thing to do in dev is to not cache. I'm not sure if there is
an auto cache cleaning tool around.

Simple.

-----Original Message-----
From: Julian Voelcker [mailto:Click here to reveal e-mail address]
Sent: Friday, March 15, 2002 1:01 AM
To: aspngcache
Subject: [aspngcache] Clearing User Control Cache

Is there any way to clear the cache so that user controls get
re-loaded? This is only really required during development.

I have been making changes to a user control, but the changes aren't
being seen on the page because the user control is being cached.

Cheers,

Julian Voelcker

| [aspngcache] member Click here to reveal e-mail address = YOUR ID
| http://www.aspfriends.com/aspfriends/aspngcache.asp = JOIN/QUIT

Reply to this message...
 
    
Alex Lowe
You should check out this article -
(http://aspalliance.com/aldotnet/examples/cacheviewer.aspx). The sample
code that is included can be easily modified so that you can remove any
item in a applications cache.

Alex - AspFriends.com Moderation Team
Microsoft MVP - ASP.NET

***********************************************************
Have a question about using client side coding in your ASP.NET pages?
Send your question to [aspngclient]
(http://www.aspfriends.com/aspfriends/aspngclient.asp)
***********************************************************

[Original message clipped]

Reply to this message...
 
    
Julian Voelcker
Thanks Guys. It's just a shame that there isn't an easier way to do
it.

I have actually decided to drop the user controls in favour of creating
my own web controls.

Cheers,

Julian Voelcker

Reply to this message...
 
    
Alex Lowe
How would you like the clearing of user control cache to be implemente
then? Please post your wishlist answer to our wishlist at
[aspngwishlist] (http://aspfriends.com/aspfriends/aspngwishlist.asp).
The ASP.NET team monitors that list and I know they are looking at many
improvements on caching functionality in the next revs. They LOVE
feedback!

Alex - AspFriends.com Moderation Team
Microsoft MVP - ASP.NET

***********************************************************
Have a question about using client side coding in your ASP.NET pages?
Send your question to [aspngclient]
(http://www.aspfriends.com/aspfriends/aspngclient.asp)
***********************************************************

[Original message clipped]

Reply to this message...
 
    
Rob Howard (VIP)
Hi Julian,

Yes, Alex is correct. We love feedback :)

If you send something to the dl below, please also cc: me directly - I
have rules that sort my mail, and cc: will land in a different folder
than anything sent to the dl.

Thanks!
Rob

-----Original Message-----
From: Alex Lowe [mailto:Click here to reveal e-mail address]=20
Sent: Monday, March 18, 2002 7:33 AM
To: aspngcache
Subject: [aspngcache] Re: Clearing User Control Cache

How would you like the clearing of user control cache to be implemente
then? Please post your wishlist answer to our wishlist at
[aspngwishlist] (http://aspfriends.com/aspfriends/aspngwishlist.asp).
The ASP.NET team monitors that list and I know they are looking at many
improvements on caching functionality in the next revs. They LOVE
feedback!

Alex - AspFriends.com Moderation Team
Microsoft MVP - ASP.NET

***********************************************************
Have a question about using client side coding in your ASP.NET pages?
Send your question to [aspngclient]
(http://www.aspfriends.com/aspfriends/aspngclient.asp)
***********************************************************

[Original message clipped]

| [aspngcache] member Click here to reveal e-mail address =3D YOUR ID
| http://www.aspfriends.com/aspfriends/aspngcache.asp =3D JOIN/QUIT

Reply to this message...
 
    
Ahmed, Salman
4 user controls on index.aspx page, each user control is individually cached
ie. region caching.

If all user controls are cached as followes:

UserControl#1 1 day
UserControl#2 1 day
UserControl#3 1 day
UserControl#4 5 minutes

Now if I were to cache index.aspx (the page that has the above usercontrols)
for 4 minutes will that effect performance? Notice that 4 minutes is less
than 5 minutes to ensure that the index.aspx cache does not override the
UserControl#4's 5 minute cache to keep all content fresh?

comments?

Reply to this message...
 
    
Mitch Denny (VIP)
Salman,

This is a border-line scenario but I think it should
work. If you think about the order in which a page is
rendered then cached, the controls are drawn first, so
the point where they are inserted into the cache is
just slightly earlier than the point that the page
itself is, which means they should time-out first.

In short, I think your logic still holds, if only
because of the rendering/caching order of the controls.

----------------------------------------
- Mitch Denny
- Click here to reveal e-mail address
- +61 (414) 610-141
-

-----Original Message-----
From: Ahmed, Salman [mailto:Click here to reveal e-mail address]
Sent: Wednesday, 20 March 2002 07:59
To: aspngcache
Subject: [aspngcache] Re: Clearing User Control Cache

4 user controls on index.aspx page, each user control is individually
cached ie. region caching.

If all user controls are cached as followes:

UserControl#1 1 day
UserControl#2 1 day
UserControl#3 1 day
UserControl#4 5 minutes

Now if I were to cache index.aspx (the page that has the above
usercontrols) for 4 minutes will that effect performance? Notice that 4
minutes is less than 5 minutes to ensure that the index.aspx cache does
not override the UserControl#4's 5 minute cache to keep all content
fresh?

comments?

| [aspngcache] member Click here to reveal e-mail address = YOUR ID
| http://www.aspfriends.com/aspfriends/aspngcache.asp = JOIN/QUIT

Reply to this message...
 
    
Julian Voelcker
Alex,

I have finally go around to look at this page and the code doesn't appear
to work on the site or on my system.

Any ideas?

Cheers,

Julian Voelcker
The Virtual World (UK) Limited
Cirencester, United Kingdom

On Sat, 16 Mar 2002 00:02:12 -0600, Alex Lowe wrote:
[Original message clipped]

Reply to this message...
 
    
Alex Lowe
What error are you getting?

Alex - AspFriends.com Moderation Team
Microsoft MVP - ASP.NET

***********************************************************
Have a question about using client side coding in your ASP.NET pages?
Send your question to [aspngclient]
(http://www.aspfriends.com/aspfriends/aspngclient.asp)
***********************************************************

[Original message clipped]

Reply to this message...
 
    
Julian Voelcker
OK, I think I am going mad.

I have been trying to make changes to pages on my site and they haven't
been appearing when I view the site.

I thought it was because the user controls were being cached.

I changed one user control into a server control and that fixed that
problem, but now I am getting other caching issues.

Before you ask I do have caching turned off on my browser.

I had assumed that the running the code you pointed me to would show
elements of the site that are being cached - like the user controls,
but it is showing up nothing, even though the user controls are being
cached.

I am slowly going bald over this because nothing seems to be working as
it should be.

Cheers,

Julian Voelcker
The Virtual World (UK) Limited
Cirencester, United Kingdom

Reply to this message...
 
    
Alex Lowe
Julian,

The cache viewer code (without modification) will only show items that
are being stored using the Caching API, not Output Caching (User
Controls and Pages). To see everything (i.e. Caching API and Output
Caching) in the cache for your web application, you need to modify the
code per the comments:

'Comment the If..Then if you want to see ALL (System, etc.) items the
cache
'We don't want to see ASP.NET cached system items or ASP.NET Worker
Processes
'If (Left(strName, 7) <> "System.") And (Left(strName, 7) <> "ISAPIWo")
Then
myCacheHashTable.Add(strName, Cache(strName).GetType().ToString())
'End If

Have you commented out the If and End If lines like I did above?

Alex - AspFriends.com Moderation Team
Microsoft MVP - ASP.NET

***********************************************************
Have a question about using client side coding in your ASP.NET pages?
Send your question to [aspngclient]
(http://www.aspfriends.com/aspfriends/aspngclient.asp)
***********************************************************

[Original message clipped]

Reply to this message...
 
    
Julian Voelcker
Hi Alex,

Thanks for the help.

I have done the commenting and can now see things, yet the page I am
trying to debug doesn't appear in the list.

The page displays a table and at the bottom of it is a label control. In
the code behind under page load I have Label1.Text = "Hello world";

When I load the page the label displays, but not the content.

If I create a new page and do the same, all works fine.

The annoying thing is this was all working a few days ago and I can't
think what I have done that could have caused the problem.

Cheers,

Julian Voelcker
The Virtual World (UK) Limited
Cirencester, United Kingdom
[Original message clipped]

Reply to this message...
 
 
System.Collections.DictionaryEntry
System.EventArgs
System.EventHandler
System.Web.UI.UserControl
System.Windows.Forms.UserControl




ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
Ad


Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification