...but i need to improve the application furthur..
...so i HAVE to outputcache a few of the more static controls...here
my voes start....
I am aware of the outputcache directive....setting varybyparams etc...
but i find it very restricted for my application... suppose i have a
control which shows a few links ....the no: of links to show is
decided on the basis of a preference setting in the database...so as
long as that preference is not modified i can just outputcache the
control... but once it is changed..i want to IMMEDIATELY invalidate
that usercontrol cache....
so that a user who is using my app...does not have to see the page
with a ui preference that has been modified according to whatever
policies decide these...
as far as i understand...and what replies i have got from MS
support..there are
is "no programmatic API to invalidate user control output caching--Rob
Howard(MS asp.net team)".....A time based expiry is not a solution for
me....
So is there any way to do this....
1)Is there any way by which i can obtain the usercontrol output...and
cache it with a key based dependency...instead of letting asp.net do
it ...cos i dont have any control on it programmatically..?
OR
2)Is there any way by which i CAN invalidate the cached output...by
someother dependency mechanism....
...CAN ANYONE DO THIS....
3)or atleast can someone enlighten me on how MS has implemented the
key based dependency on the Cached page output(WHY THE HELL HAVE THEY
NOT PROVIDED THE SAME WITH THE CACHED USER CONTOL OUTPUT)...so that i
can attempt to do something like that...
...one interesting thing....user controls in which i set a output
cache will get compiled into a partialcachingcontrol... this class has
a property...cacheditemdependency....but i dont find any way in which
i can access this property...?(any ideas.)
PLLLLLZZZZZ...help
RAZORRASU
I guess it would probably look something like this:
protected override void Render(System.Web.UI.HtmlTextWriter writer)
{
String controlHtml = (String)Cache["testControlHtml"];
if( controlHtml==null )
{
StringWriter sw = new StringWriter();
HtmlTextWriter newWriter = new HtmlTextWriter( sw );
base.Render( newWriter );
controlHtml = sw.ToString() + "<br><br>Generated at: " +
DateTime.Now.ToString();
Cache.Insert( "testControlHtml", controlHtml, null,
DateTime.Now.AddSeconds( 5 ),
System.Web.Caching.Cache.NoSlidingExpiration );
}
writer.Write( controlHtml );
}
...without error handling or thread synchronisation.
Hope this helps
Regards
James.
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"erasor" <razo...@yahoo.com> wrote in message
news:8df61cf2.03040...@posting.google.com...
this is what i did...
put an @outputcache directive in the usercontrol...
put a place holder in the aspx page..
did not drop the control on to the page..
on page_load of the aspx..
i did..
partialcachingcontrol
pc=(PartialCachingControl)LoadControl("CachedUserControl.ascx");
pc.Dependency=new CacheDependency(null,new string[]{MySettings});
PlaceHolder.Controls.Add(logo);
...
this works...even the invalidation part...i ran a few stress test
using this method but i was not able to conclusively decide whether
this is a good way of doing it performance wise....
any suggestions..any obvious problems using this method...especially
when the number of users accessing the page increases ?
thnx once more...will try out ur sugg...
erasor...
placeholder.Controls.Add(logo);
..please read as...
placeholder.Controls.Add(pc);
erasor..
Regards
James.
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"erasor" <razo...@yahoo.com> wrote in message
news:8df61cf2.03041...@posting.google.com...