I have implemented my own SqlCacheDependency
public SqlCacheDependency CacheControllerDependency(CacheControllerKeys cacheKey)
{
SqlConnection conn = new SqlConnection("connection");
try
{
SqlCommand command = new SqlCommand(
@"SELECT [CacheName]
,[CacheReloadDate]
,[CacheReloadSource]
FROM [dbo].[CacheController] WHERE CacheName = @CacheName", conn);
SqlParameter paraCacheName = new SqlParameter("@CacheName", SqlDbType.NVarChar, 100);
paraCacheName.Value = cacheKey.ToString();
command.Parameters.Add(paraCacheName);
SqlCacheDependency dependency = new SqlCacheDependency(command);
conn.Open();
command.ExecuteNonQuery();
return dependency;
}
catch (System.Exception ex)
{
_log.Error(ex);
throw;
}
finally
{
if (conn != null)
{
conn.Close();
}
}
}
This works but in profiler I have to much queries (5 per second) for
exec sp_executesql N'SELECT [CacheName]
,[CacheReloadDate]
,[CacheReloadSource]
FROM [dbo].[CacheController] WHERE CacheName = @CacheName',N'@CacheName nvarchar(100)',@CacheName=N'MyCacheName'
Is there a setting where I can tell the SqlCacheDependency-System to take it easy a bit? I dont care if my Cache is not up to date for 10min.