Y
Yosi
Hi,
I have a wierd problem about the SqlCacheDependency class. It just
works for a couple of minutes. After 2 minutes or more, the cache does
not expire anymore. I'm using SQL Server 2005 as database.
Here is the code:
private string getTime()
{
string time = (string)Cache["KEY"];
if (time == null)
{
SqlConnection sqlConnection = new
SqlConnection(@"Server=BIZYUSUF\SQL2005;Database=Deneme2;User
Id=sa;Password=;");
SqlCommand command = new SqlCommand(@"select KOLON1 from
dbo.CACHE_DENEME3", sqlConnection);
sqlConnection.Open();
SqlCacheDependency dependency = new SqlCacheDependency(command);
time = System.DateTime.Now.ToString();
Cache.Insert("KEY", time, dependency);
command.ExecuteReader();
sqlConnection.Close();
}
return time;
}
When there is no activity for 2-3 minutes , the cache does not expire
anymore. Even that I insert a record to the CACHE_DENEME3 table, the
page reads from the cache.
Am I the only person, encountering this issue ?
I have a wierd problem about the SqlCacheDependency class. It just
works for a couple of minutes. After 2 minutes or more, the cache does
not expire anymore. I'm using SQL Server 2005 as database.
Here is the code:
private string getTime()
{
string time = (string)Cache["KEY"];
if (time == null)
{
SqlConnection sqlConnection = new
SqlConnection(@"Server=BIZYUSUF\SQL2005;Database=Deneme2;User
Id=sa;Password=;");
SqlCommand command = new SqlCommand(@"select KOLON1 from
dbo.CACHE_DENEME3", sqlConnection);
sqlConnection.Open();
SqlCacheDependency dependency = new SqlCacheDependency(command);
time = System.DateTime.Now.ToString();
Cache.Insert("KEY", time, dependency);
command.ExecuteReader();
sqlConnection.Close();
}
return time;
}
When there is no activity for 2-3 minutes , the cache does not expire
anymore. Even that I insert a record to the CACHE_DENEME3 table, the
page reads from the cache.
Am I the only person, encountering this issue ?