I think there are some steps to enable SQL Cache Depdndency :
Enabling notifications, changes in web.xml and then using Cache Dependency object.
Please help how do I pass through them ?
I think there are some steps to enable SQL Cache Depdndency :
Enabling notifications, changes in web.xml and then using Cache Dependency object.
Please help how do I pass through them ?
Have a look at this post. It takes you through using the Aspnet_regsql.exe tool, which sets it up for you.
Here is an excerpt from the above post:
...To enable a cache dependency on a particular database, run this command:
aspnet_regsql.exe -S server -U user -P password -d database -ed
This creates a new table, AspNet_SqlCacheTablesForChangeNotification,
in the designated database. Next, several AspNet_SqlCacheXxxx stored procs
are created in the same database.
Then look at this post from MSDN for an overview, with lots of How-to links.
To enable a table for SQL cache dependency use, you'll need to first run the aspnet_regsql.exe
tool from a command-line prompt, with these options:
aspnet_regsql -S servername -U login -P password -ed -d databasename -et -t tablename
In your web.config, you'll need to add a caching
section:
<system.web>
<caching>
<sqlCacheDependency enabled = "true" pollTime = "60000" >
<databases>
<add name="northwind"
connectionStringName="Northwind"
pollTime="9000000"
/>
</databases>
</sqlCacheDependency>
</caching>
</system.web>
When you add an item into your Cache, you use the SqlCacheDependency object to set up the relationship between the cached object and the underlying table:
SqlCacheDependency dependency = new SqlCacheDependency("databasename", "tablename");
Cache.Add(key, object, dependency);