sqlcachedependency

SQL Column name for indicating a change

Hi, I didn't really know how to formulate the title. But this is my problem. We are using SqlCacheDependencies to update out cache objects. But the query behind this is "complicated" that we would like to make it somewhat easier. Our first thought was to add a fieldname like DateChanged and use the DateChanged to check if an object has...

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 SQLCacheDependency objects (query notifications) have negative effect on SQL Server performance...

Anyone ever try this: Custom VirtualPathProvider (SQL Based) with SqlCacheDependency, SQL2005 and Service Broker?

I've been toying with the VirtualPathProvider the last couple of days and have gotten to the stage where I'm serving my aspx files from a SQL database but am stuck when it come to a method of invalidating the ASP.NET cache whenever a row on my database changes. So far I've managed to get it working using the SQL2000 method of SqlCacheDe...

How do I check if SqlCacheDependency is enabled at runtime?

I am using SqlCacheDependency with polling in an ASP.NET project. Sometimes, I need to disable SqlCacheDependency, which I do as follows: <caching> <sqlCacheDependency enabled="false" pollTime="10000"> <databases> <!-- ... --> </databases> </sqlCacheDependency> </caching> However, this causes an error in my code whe...

ASP.NET set cache dependency with a SqlCommand

Is this an effective way to set the cache item dependent on the query? HttpRuntime.Cache.Insert( "ListLanguages", list, new SqlCacheDependency(command), DateTime.UtcNow.AddMinutes(AppConfiguration.CacheExpiration.MinimumActivity), Cache.NoSlidingExpirati...

Cache and SqlCacheDependency (ASP.NET MVC)

We need to return subset of records and for that we use the following command: using (SqlCommand command = new SqlCommand( "SELECT ID, Name, Flag, IsDefault FROM (SELECT ROW_NUMBER() OVER (ORDER BY @OrderBy DESC) as Row, ID, Name, Flag, IsDefault FROM dbo.Languages) results WHERE Row BETWEEN ((@Page - 1) * @ItemsPerP...

Why doesn't sql cache dependency remain valid?

I can't get the SqlCacheDependency to remain valid after the ExecuteReader() instruction. Please see comment in code. using (SqlConnection connection = new SqlConnection(AppConfiguration.GetInstance.DefaultConnectionString())) { using (SqlCommand command = new SqlCommand("ListLanguages", connection)) { command.CommandTyp...

Why does stored procedure invalidate SQL Cache Dependency?

After many hours, I finally realize that I am working correctly with the Cache object in my ASP.NET application but my stored procedures stops it from working correctly. This stored procedure works correctly: CREATE PROCEDURE [dbo].[ListLanguages] @Page INT = 1, @ItemsPerPage INT = 10, @OrderBy NVARCHAR (100) = 'ID', @OrderDirection NV...

Invalid Sql Cache Dependency, SELECT TOP statements and pagination queries using ROW_NUMBER()

I have found that regular pagination methods (for example, 2 nested SELECT staments that use ROW_NUMBER() to create a temporary field) do not allow SqlCacheDependency to work properly when we set the dependency to work on a command (it only works well if it depends on the table which is not the desired effect). The same happens when I u...

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 environment, each web server has its own data cache that is not shared across servers. Is...

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 midnite, it's not pulling in the most correct data, until the cache expires. I basically...

how to use sqlcachedependency for each user in asp.net mvc

I have an application in asp.net mvc (C#), in which each user have different products sharing a common table separated by user id. I need to implement SqlCacheDependency for each user's products. The Scenario is: say there are two users (user1 and user2) and products assigned for them based on the user id. I need to cache the product...

SQLCacheDependency with SqlCommand never null

I need to implement cache dependency on a sql select command that selects one value (latest modified date of some rows). My problem is that although I update the content and when I run the query manually, I see the new date, the system doesn't think it changed and doesn't refresh the content. object Taxonomy = GetTaxonomy(); ...

SQL Cache Dependency not working with Stored Procedure

Hello, I can't get SqlCacheDependency to work with a simple stored proc (SQL Server 2008): create proc dbo.spGetPeteTest as set ANSI_NULLS ON set ANSI_PADDING ON set ANSI_WARNINGS ON set CONCAT_NULL_YIELDS_NULL ON set QUOTED_IDENTIFIER ON set NUMERIC_ROUNDABORT OFF set ARITHABORT ON select Id, Artist, Album from dbo.PeteTest And h...

sql server 2008 - sqlcachedependency without trigger?

I am so puzzled. I am using this open-source snippet. I have a table without any triggers in SQL Server, and yet the SQLCacheDependency is working fine. I thought you needed triggers on the table for it to work?! DateTime localFileTimeStamp = DateTime.Now; DateTime fileTimeStampInDB; ...

SqlCacheDependency and output cache invalidation

Hi , Suppose I have a page abc.aspx in it I have a user control ucx123.ascx. I am fragment caching the user control and the cache is vary by param. The parameter is some id in the querystring. I want to add a sql cache dependency with respect to sql query. The scenario is I added the dependency but the cache is not invalidating ...

Adding Sql Cache Dependency in User Control?

Adding Sql Cache Dependency in User Control? How to add Sql Cache Dependency when we are using fragment caching. ...

Caching a user control

I have a user control which I want to Output cache( fragment cache) and set the dependency to a query. I mean that on change or modification of data returned by that query the cache should get invalidated. I have read that in the output cache directive in the user control Sqldependency = "CommandNotification" cannot be used. So, how sh...

Caching and cache invalidation in user controls?

HI, In our .aspx pages we have many user controls. each user control executes a sql query. The caching mechanism to be followed is to fragment cache each user control on the page and add the query dependency to the respective queries of the user controls. How to achieve query dependency on fragment cached data for invalidation? ...

Using SqlCacheDependency with output caching

Hi Iam adding SqlCacheDependency programmatically but Iam not able to invalidate the cache. Iam using the following Output cache directive in the .aspx page <%@ OutputCache Duration="300" VaryByParam="none" %> The code in the .aspx.cs file is: SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnStr"...