[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

Cache dependency not invalidating cache

RuthG

6/15/2009 6:42:00 PM

I am using Visual Studio and asp.net. My main page shows a summary
list of
all accounts. The data source for the select is a SQL Server stored
procedure
that accesses 3 tables. A button on the page can redirect the user to
a page
for entering a new account. That page can insert data into all 3
tables.
After the insert stored procedure runs, I redirect the user back to
the first
page but the new data does not show up there. The old cache is being
used. Here is how I set up the cache dependency:

1. From Visual Studio, command line, aspnet_regsql, I enabled database
cache
dependency and also ran it for 4 table ( the 3 referenced above and
one more
that I want to reflect updates.) Note my -S had to refer to a named
instance
(localhost didn't work) because I can be running different instances
on my
computer for different projects. This seemed to work fine and generate
the
proper tables.
2. I added a <caching> element to <system.web> in web.config:
<caching>
<sqlCacheDependency enabled="true">
<databases>
<add name="AdminiSafe"
connectionStringName="AdminiSafeConnectionString2"/>
</databases>
</sqlCacheDependency>

</caching>
3. To my SQLDataSource on my main master page (the datasource and
master are
used on multiple pages - so they are defined in a master), I added to
Enable
Caching =" true":
CacheDuration="3600"

SqlCacheDependency="AdminiSafe:Table1;AdminiSafe:Table2;AdminiSafe:Table3"

This all had no effect. The new data I inserted into the tables did
not show
up on the main page until the CacheDuration passed.

I also tried adding to the main page (with and without SqlDependency),
without success:
<%@ OutputCache VaryByParam = "False" Duration = "3600"
SqlDependency="AdminiSafe:Table1" %>

Did I miss something? Is there a problem because I am using a master
page or a stored procedure?