ASP.NET Caching with SqlCacheDependency

ASP.NET has various caching technique for various caching requirements. One among them  is using SqlCacheDependency class. SqlCacheDependency is a powerful class used for ASP.NET caching. This class is useful for setting an output data caching depending on the data in a table or row.

Sometime we need to cache the data from the table. But we may need to remove the cache if the table got updated with new data. SqlCacheDependency class comes handy for this situation. A good example for the usage of this class is showing the product stock count. When the customer browses through the product, we may not need to fetch the stock availability count for the database every time.  Instead we can cache the stock count. But, the cache should be removed if someone purchased the product and if the stock count changes. In this scenario we can use the SqlCacheDependency class to watch the product stock count record and remove the cache from the server.


Below are some of the articles which will help to implement Sql cache dependency technique in a ASP.NET website connected to SQL Server database.

Leave your thoughts...

This site uses Akismet to reduce spam. Learn how your comment data is processed.