Follow Fantora on Twitter
Fantora Word of Classified Ads and Community Forum
Welcome Guest Search | Active Topics | Members | Log In | Register

SQL Cache Dependency

Options
richard
Posted: Friday, August 28, 2009 3:42:29 AM
Rank: Advanced Member
Groups: Member

Joined: 6/9/2008
Posts: 202
Points: 618
Location: California, USA

SQL Cache Dependency

Hi,

I am working on an application where we use caching extensively. I have a small problem with the caching part. I am trying to use SQLCacheDependency on my cache objects. To give you a brief, we cache the items groupwise based on projects. So i will have more than one cache object for a particular group and likewise for other groups. My requirement is that, if i edit one particular group, i would want to clear the cache items of only that group. When i tried implementing SQLCacheDependency, i was getting the following error

An attempt was made to reference a "CacheDependency object from more than one Cache entry". I am working on creating a file based dependency, but if theres something that can be done to make the SQLCacheDependency, it would be great. I am also attaching the code snippet for the same.
Code:
using (SqlConnection cn = new SqlConnection(m_ConnectionString))

{
m_CommandString = " < Query > ";

cn.Open();
using (SqlCommand cm = new SqlCommand(m_CommandString, cn))

{
SqlCacheDependency dep = new SqlCacheDependency(cm);

SqlDataAdapter da = new SqlDataAdapter(cm);
DataTable dt1 = new DataTable();

DataTable dt2 = new DataTable();

da.Fill(dt1);da.Fill(dt2);
Cache.Insert("Group 1", dt1, dep);

Cache.Insert("Group 2", dt2, dep); //   I get the error in this line

}

}


Thanks in advance
adam
Posted: Friday, August 28, 2009 3:45:08 AM
Rank: Advanced Member
Groups: Member

Joined: 4/3/2008
Posts: 183
Points: 555
Location: London

SQL Cache Dependency

HI, richard:

I have not found some approach to make one SqlCacheDependency relate to multiple cache entries. However, i want to recommend you to organize your several cache entries into one collection or one array and relate it with one SqlCacheDependency.

If i misunderstand you about your question, please feel free to correct me and i will try to help you with more information.

I hope the above information will be helpful. If you have any issues or concerns, please let me know. It's my pleasure to be of assistance
johnpatrick
Posted: Thursday, February 25, 2010 2:21:21 AM
Rank: Member
Groups: Member

Joined: 2/25/2010
Posts: 10
Points: 30
Location: GB

SQL Cache Dependency

richard wrote:
Hi,

I am working on an application where we use caching extensively. I have a small problem with the caching part. I am trying to use SQLCacheDependency on my cache objects. To give you a brief, we cache the items groupwise based on projects. So i will have more than one cache object for a particular group and likewise for other groups. My requirement is that, if i edit one particular group, i would want to clear the cache items of only that group. When i tried implementing SQLCacheDependency, i was getting the following error

An attempt was made to reference a "CacheDependency object from more than one Cache entry". I am working on creating a file based dependency, but if theres something that can be done to make the SQLCacheDependency, it would be great. I am also attaching the code snippet for the same.
Code:
using (SqlConnection cn = new SqlConnection(m_ConnectionString))

{
m_CommandString = " < Query > ";

cn.Open();
using (SqlCommand cm = new SqlCommand(m_CommandString, cn))

{
SqlCacheDependency dep = new SqlCacheDependency(cm);

SqlDataAdapter da = new SqlDataAdapter(cm);
DataTable dt1 = new DataTable();

DataTable dt2 = new DataTable();

da.Fill(dt1);da.Fill(dt2);
Cache.Insert("Group 1", dt1, dep);

Cache.Insert("Group 2", dt2, dep); //   I get the error in this line

}

}


Thanks in advance



thanks its goods

History Essay
How to Write An Essay
How to Write Essay
Student Essays
Link Exchange Blog
Users browsing this topic
Guest

 Related
how to remove 404 error
Linq query in MVC
creating a profile in commerce server 2009 pragmatically
A little confusion on ICallbackEventHandler
using AdRotator control in ASP.Net
Could not load file or assembly 'XXX, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' ..
Commerce Server 2009 Starter Site step by step
nopCommerce ASP.NET/C# based opensource shopping cart Installation
MVC Application Structure
'System.Exception' was thrown
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Fantora Blog | Discount Shop UK | Discount Shop USA | Discount Shop Canada | Discount Boutique France | Discount Shop Deutschland | Discount Shop Italia | Descuento Shop España

Free Classified ads, Webmaster Forum & Technology Reviews | Fantora Free Classified Ads | Buy & Sell Electronics, Mobile phones & Accessories | fantora Forums Community | Buy & Sell DVD, Games and Consols | Free eBooks & Softwares | SEO & Affiliate Marketing Discussion | Programming Language Forum (.NET, ASP, PHP, SQL) | Free Classified Ads | General Stuff (Movies, Chat, Comics) | Free Online English Movies & Reviews | Free Online Hindi Movies & Reviews | Australia & New Zealand Immigration Forum | Europe immigration forum | Canada Immigration Forum | Ireland Immigration Forum | US Immigration Forum | United Kingdom Immigration Forum

Main Forum RSS : RSS

Powered by: YAF.NET
Copyright © AI Logica All rights reserved.
This page was generated in 1.352 seconds.