Questions tagged [sqlcachedependency]

Establishes a relationship between an item stored in an ASP.NET application's Cache object and either a specific SQL Server database table or the results of a SQL Server 2005 query

System.Object
. System.Web.Caching.CacheDependency
. . System.Web.Caching.SqlCacheDependency

Namespace: System.Web.Caching
Assembly: System.Web (in System.Web.dll)

On all supported versions of SQL Server (Microsoft SQL Server 7.0, Microsoft SQL Server 2000, and SQL Server 2005) the SqlCacheDependency class monitors a specific SQL Server database table. When the table changes, items associated with the table are removed from the Cache, and a new version of the item is added to the Cache.

http://msdn.microsoft.com/en-us/library/system.web.caching.sqlcachedependency.aspx

78 questions
52
votes
6 answers

Enabling Service Broker in SQL Server 2008

I am integrating SqlCacheDependency to use in my LinqToSQL datacontext. I am using an extension class for Linq querys found here - http://code.msdn.microsoft.com/linqtosqlcache I have wired up the code and when I open the page I get this exception -…
JGilmartin
  • 8,683
  • 14
  • 66
  • 85
23
votes
5 answers

Performance questions for SQL Cache Dependency

I'm working on a project where we are thinking of using SQLCacheDependency with SQL Server 2005/2008 and we are wondering how this will affect the performance of the system. So we are wondering about the following questions Can the number of…
12
votes
3 answers

Why does my SqlCacheDependency HasChanged come back false but almost immediately after changes to true?

I cannot figure out why the HasChanged value of my SqlCacheDependency object is coming back originally from the command execution as false, but somewhere almost immediately after it comes back from the database, the value changes to true. …
The Evil Greebo
  • 7,013
  • 3
  • 28
  • 55
7
votes
1 answer

How does a SqlCacheDependency know when to communicate back to any listeners when data in a table changes?

I have been doing some research and I can see most of the plumbing for this system however I'm not sure how sql server knows when to fire a message back to any listeners (applications) when data in a table changes, for instance. I'll start by…
longda
  • 10,153
  • 7
  • 46
  • 66
7
votes
3 answers

Clear the cache at a specific time in ASP.NET 2.0

So I have a process which runs at midnight which sets a start and end point for a flash object. This only needs to run once a day, so I'm obviously caching the result set. However, the problem I'm running into is, if the data is still cached after…
Jack Marchetti
  • 15,536
  • 14
  • 81
  • 117
6
votes
2 answers

Is Caching in C# the right approach for me?

I've tried to read up on Caching in ASP.NET and still have a few questions. When using a Sql Cache Dependency ... I know that you can specify which tables will be monitored but if a change happens to any one of those tables does it reset the…
cavillac
  • 1,311
  • 12
  • 22
6
votes
3 answers

Extending ASP.NET data cache to be shared across web farm

I have an ASP.NET application that makes extensive use of ASP.NET cache API for caching commonly-used data. In addition, I am using polling-based sql cache dependency to track expiration. The drawback of the current design is that, in the web farm…
frankadelic
  • 20,543
  • 37
  • 111
  • 164
5
votes
2 answers

.Net core SQL cache dependency

I am trying to implement caching in ASP.Net core app. Currently What I have implemented is In Memory caching using IMemoryCache but what I want is cache should get invalidated if corresponding record in SQL server 2016 gets changed. One way I found…
AnandSonake
  • 567
  • 1
  • 8
  • 19
4
votes
2 answers

Simple SqlCacheDependency

Almost every tutorial I have read seems to incorrectly setup SqlCacheDependency. I believe they normally mix up the outdated polling method with the query notification method. Here are two of many examples: Web Caching with SqlCacheDependency…
ParoX
  • 5,685
  • 23
  • 81
  • 152
4
votes
2 answers

Use wildcards when searching in HttpContext.Cache

Is there a way to use wildcards or a regex to search and remove items from HttpContext.Cache? I can have in my cache "item_1", "item_2",...,"item_n" and I want to remove from cache all values that are related to keys with the pattern "item_*". How…
Buda Gavril
  • 21,409
  • 40
  • 127
  • 196
4
votes
2 answers

SqlCacheDependency/SqlDependency and columns

I am using the following code to cache with dependency on change of "People" table's, "Name" column. However, in a row if some other column such as Address column changes then also dependency fires and purges the cache. (ASP.NET 4.0 with SQL Server…
lockedscope
  • 965
  • 17
  • 45
3
votes
1 answer

SqlCacheDependency on Views and Procedures

I want to use SqlCacheDependency with the views and procedures. I am using Linq to Sql. The code i am currently using is valid only if you are using a Single Table: public static List LinqCache(this System.Linq.IQueryable q,…
Moons
  • 3,833
  • 4
  • 49
  • 82
3
votes
1 answer

ASP.NET Cache always returns null

I am using SQLCacheDependency in my ASP.NET application with Query Notifications. I followed this article to set up my database with success.However whenever I am trying to store data in the cache object.It just does not hold value.It is always null…
Priyank Patel
  • 6,898
  • 11
  • 58
  • 88
2
votes
1 answer

Column Specific SqlCacheDependency in ASP.NET

I want to have a column specific SqlCacheDependency. The Row Specific SqlCacheDependency is valid but i dont know how can i make Column Specific SqlCacheDependency Example: The query: SELECT [Extent1].[Price] AS [Price] FROM [dbo].[Products] AS…
Moons
  • 3,833
  • 4
  • 49
  • 82
2
votes
1 answer

Cache invalidation notification SqlCacheDependency

I am trying to create SQL cache dependency for some reference data in my ASP.NET application (ASP.NET 3.5, SQL 2008). I have enabled sql caching for my database and a couple of tables using aspnet_regiis utility. I have made the required…
klone
  • 2,005
  • 2
  • 16
  • 18
1
2 3 4 5 6