[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.aspnet.caching

HttpContext.Current.Cache behaviour issue

Roberta

4/13/2006 2:43:00 PM

Hi

I have an issue with the Cache behaviour between a webpart page and ordinary
aspx pages.
The application I've developed used caching already- with a file dependency-
and this worked a treat.

We then updated the webpart to add a dataset we built up in memory to the
cache with options to turn on caching and the cache timeout as toolpane
properties of the webpart.

This worked fine also.
However we have 2 pages that run off the webpart that email the data and
export the data - and we hoped to use this cached dataset for these calls
also- however - when testing this I found very strange behaviour which I
cannot find any documentation on. The dataset is cached on rendering the
webpart with the timeout set. I then launch the new aspx page from the
webpart and in here try to pull the dataset back from the cache using the
correct key ( this i have checked numerous times!) The dataset is not in the
cache at this point ( and is inserted into the cache). I tested this
numerous times - and found that I seem to be looking at two different context
objects? When I Page.Trace HttpContext.Current.Cache.Count in the webpart - I
may have 5 items - I then page.trace the HttpContext.Current.Cache.Count in
the aspx page - and could come back with one.

Once the item is places into the cache in the email page - it remains there
until the timeout . Once its in the cache in the email page- its then
available in the export page!

The idead behind the caching - was that the dataset that was cached - that
the user saw- would be the one that was emailed - this will no longer be the
case - as the one emailed will be the more up-to-date version- and also the
email page will take longer to accomplish its task as it has to regenerate
the dataset from scratch.

Can anybody please spread some light on this issue for me?


Cheers