PC Review


Reply
Thread Tools Rate Thread

Cache(Query Notification)

 
 
Ravi
Guest
Posts: n/a
 
      17th Jan 2008
Hi,
We are planning to use SqlCacheDepency in our application(ASP.Net2.0/SQL
Server 2005).I was just doing a POC and found the Cache addition and
invalidation is behaving abnormally. I just wanted to know where its going
wrong.
I have a command object as dependency. The stored proc. returns result set
based on filter param. Basically its simple select <col1>,<col2> from
dbo.<tablename> where id = <param>. When I add a object into cache with the
above dependency cmd I can see the Cache object is still empty but a
notification entry in SQL 2005(select * from sys.dm_qn_subscriptions). But
sometimes there is an entry in ASP cache object but no notification entry in
SQL 2005. Why is it behaving strangely? I have re-produced this after
restarting IIS and clearing sql of all notifications.
Can some one help me on this?


sample code:
bool blnDepend =
System.Data.SqlClient.SqlDependency.Start("uid=<>;pwd=<>;data
source=(local);initial catalog=<>;");

con.Open();
SqlCommand cmd = new SqlCommand();
cmd.Connection = con;
cmd.CommandText = "dbo.GetAllTasks";
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@TNAME", SqlDbType.NChar, 10);
cmd.Parameters["@TNAME"].Value = "T1";
cmd.Prepare();
System.Web.Caching.CacheDependency sqldependency = new
System.Web.Caching.SqlCacheDependency(cmd);
SqlDataAdapter da = new SqlDataAdapter(cmd);

DataSet ds = new DataSet();
da.Fill(ds);

object o = HttpContext.Current.Cache.Add("T1", "hello",
sqldependency, System.Web.Caching.Cache.NoAbsoluteExpiration,
System.Web.Caching.Cache.NoSlidingExpiration,
System.Web.Caching.CacheItemPriority.Normal, null);


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
data cache invalidation: the old sql 2000 polling way or the new sql 2005 notification way? JX Microsoft ADO .NET 0 12th Nov 2007 07:05 AM
SQL cache notification. Nadia Amir Microsoft Dot NET 0 15th Dec 2006 11:45 AM
Reseting cache for SQL server query =?Utf-8?B?RGF2ZQ==?= Microsoft ASP .NET 1 20th Dec 2004 05:25 AM
Query ARP Cache in vb.net =?Utf-8?B?bWFidUhC?= Microsoft Dot NET 2 25th Nov 2004 02:31 PM
Schema Cache Query Rob Preston Microsoft Windows 2000 Advanced Server 1 11th Jul 2003 06:30 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:10 PM.