asp.net-core.net-coresqlcachedependency

.Net core SQL cache dependency


I am trying to implement caching in ASP.Net core app. Currently What I have implemented is In Memory caching using IMemoryCache but what I want is cache should get invalidated if corresponding record in SQL server 2016 gets changed. One way I found it SQLCacheDependency but it is not a part of .Net Core as per this link

Any thoughts on this ?


Solution

  • Right now this class hasn't been migrated to the .Net Core, so you can't easily manage out such logic. Probably it will be a part of .Net Standard 2.0, so you either implement some temporary solution with CancellationChangeToken with direct sql database checks (which is very inefficient) or wait for update.