C#,vb.net,MVC,Jquery,javascript,jscript,vbscript,html,vb,sharepoint,COM,WPF,WCF,Wwf,Asp,Asp.net,questions & answers,

Latest in Sports

Tuesday, October 14, 2014

Refresh Cache when data is changed in the the data base using System.Runtime.Caching

For one of my requirement in WCF service I  need to implement  caching using new functionality  System.Runtime.Caching in don’t.net 4.0.
For which my caching should be refreshed only when the data base values are changed in the data base.

I am able to get my data from the table using a stored procedure and then cache the data, But I need to refresh the data when the data is changed in the data base.

I have tried using the below to implement. But I am not able to get the values when the data base values are changed.
SqlDependency sqlDep = new SqlDependency();
SqlChangeMonitor monitor = new SqlChangeMonitor(sqlDep);

If anyone has implemented this functionality , please share the details. I are using  Visual Studio – 2012, C#.


SOLUTION :

SqlCacheDependency class should help, Please refer to the link below:

No comments:

Post a Comment