473,385 Members | 1,279 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

SqlCacheDependency - Cache Invalidation wihout result set modification

Using the SQL 2005 "query notification" caching mechanism, I am caching
three columns (UserId, UserName, Password) of a table called UserInfo
in my web application cache. However, the cache gets invalidated (and
needs to be re-loaded) when another column LastUpdateDateTime of the
same table gets modified. This is NOT as per my expectation. Following
is what MSDN says about Query Notifications in SQL2005
(http://msdn2.microsoft.com/en-us/lib...4(VS.80).aspx).

"SQL Server 2005 cache dependency is more flexible in the types of
changes that receive notification. SQL Server 2005 monitors changes to
the result set of a particular SQL command. If a change occurs in the
database that would modify the results set of that command, the
dependency causes the cached item to be invalidated. This allows SQL
Server 2005 to provide row-level notification."

This means, regardless of updates done to the table, as long as the
result set of the query is not modified (that is, produces the same
result), the cache should not be invalidated. This is not happening in
my web application. I am not sure if this is an already identified
issue with SqlCacheDependency, SQL2005 (Standard Edition) or the way I
have used these features in my application.

I have also verified this behavior with a Windows Desktop application
and using SqlDependency object. The SqlDependency.OnChange event
handler gets called for ANY updates performed on the table and NOT just
for updates that modify the result set of my query.

Jan 8 '07 #1
2 2078
Why the X-Post?

--
Regards,
Alvin Bruney
------------------------------------------------------
Shameless author plug
Excel Services for .NET is coming...
OWC Black book on Amazon and
www.lulu.com/owc

<mr***********@hotmail.comwrote in message
news:11**********************@11g2000cwr.googlegro ups.com...
Using the SQL 2005 "query notification" caching mechanism, I am caching
three columns (UserId, UserName, Password) of a table called UserInfo
in my web application cache. However, the cache gets invalidated (and
needs to be re-loaded) when another column LastUpdateDateTime of the
same table gets modified. This is NOT as per my expectation. Following
is what MSDN says about Query Notifications in SQL2005
(http://msdn2.microsoft.com/en-us/lib...4(VS.80).aspx).

"SQL Server 2005 cache dependency is more flexible in the types of
changes that receive notification. SQL Server 2005 monitors changes to
the result set of a particular SQL command. If a change occurs in the
database that would modify the results set of that command, the
dependency causes the cached item to be invalidated. This allows SQL
Server 2005 to provide row-level notification."

This means, regardless of updates done to the table, as long as the
result set of the query is not modified (that is, produces the same
result), the cache should not be invalidated. This is not happening in
my web application. I am not sure if this is an already identified
issue with SqlCacheDependency, SQL2005 (Standard Edition) or the way I
have used these features in my application.

I have also verified this behavior with a Windows Desktop application
and using SqlDependency object. The SqlDependency.OnChange event
handler gets called for ANY updates performed on the table and NOT just
for updates that modify the result set of my query.

Jan 8 '07 #2
I just wanted to get attention of a maximum number of users to quickly
resolve the issue that I am facing; sorry if this is not the proper
way...
Does anybody here have come across the problem and devised a way around
/ found proper solution etc.?

Jan 10 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: stewart | last post by:
I've got the standard SqlCacheDependency working just fine , ie. I've defined (and encrypted) the connectionStrings section in the web.config, and I've also defined an an sqlCacheDependency in the...
5
by: Adrian Parker | last post by:
I've got the standard SqlCacheDependency working just fine , ie. I've defined (and encrypted) the connectionStrings section in the web.config, and I've also defined an an sqlCacheDependency in the...
5
by: Joel Barsotti | last post by:
I'm trying to get sql cache dependency working correctly. I've got sql server 2005 for my back end. I've don the "ALTER DATABASE dbName SET broker_enable" command. I made sure the user in my...
2
by: chris | last post by:
Hello all, Background: Using .NET 2.0, Sql Server 2005, SqlCacheDependency is utilized successfully against SqlCommand objects elsewhere in the code (in other words I have successful instances...
10
by: J055 | last post by:
Hi I've been trying out SqlCacheDependency using the ObjectDataSource and SQL Server 2005. It all works quite well with the minimum of configuration, e.g. <asp:ObjectDataSource...
4
by: Reinout | last post by:
Hi I set up a sql cache dependency, but always receive a "DependencyChanged" notification straight away (through CacheItemRemoved callback). Modifying the procedure didn't help me. It used to...
1
by: mark4asp | last post by:
Help: SQLCacheDependency not working. When I step through my code with the debugger I notice that the condition below: (cacheItem == null) is always true. I have setup SQLCacheDependency...
1
by: | last post by:
Hey Guys, I have been struggling with this for few days. when i use SqlCacheDependency sqlDependency=new SqlCacheDependency("test","dbo.USStates"); where test is the name of...
7
by: Adrian | last post by:
Hi, I'm trying to add caching to our asp app, but am having problems with the SQLCacheDependancy not invalidating the cache when the table changes. Using vs2008, sqlserver 2005 developer edition....
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.