A
Adrian
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.
So far I've added the following to the application_start event..
System.Data.SqlClient.SqlDependency.Start("connectionstring as the sa user")
and against the db, I did
ALTER DATABASE mydb SET ENABLE_BROKER
I have the following routine to return a cache version of a table called puptext..
Public Shared Function GetPupText() As IQueryable(Of PUPTEXT)
If Cache("puptext") Is Nothing Then
Dim DB As New DBDataContext
Dim pt = From i In DB.PUPTEXT Select i
Dim SCD As New SqlCacheDependency(DB.GetCommand(pt))
Cache.Insert("puptext", pt, SCD)
End If
Return Cache("puptext")
End Function
Firstly, is this how you'd usually cache a linq result?
Are there any other commands you have to issue to get the cache invalidity notification to work?
Using vs2008, sqlserver 2005 developer edition.
So far I've added the following to the application_start event..
System.Data.SqlClient.SqlDependency.Start("connectionstring as the sa user")
and against the db, I did
ALTER DATABASE mydb SET ENABLE_BROKER
I have the following routine to return a cache version of a table called puptext..
Public Shared Function GetPupText() As IQueryable(Of PUPTEXT)
If Cache("puptext") Is Nothing Then
Dim DB As New DBDataContext
Dim pt = From i In DB.PUPTEXT Select i
Dim SCD As New SqlCacheDependency(DB.GetCommand(pt))
Cache.Insert("puptext", pt, SCD)
End If
Return Cache("puptext")
End Function
Firstly, is this how you'd usually cache a linq result?
Are there any other commands you have to issue to get the cache invalidity notification to work?