SQL Cache Dependency in ASP.NET

It is containing all topics related to Visual Basic, .NET Framework, Web Resource, GDI etc.
Ladva Nidhi
Posts: 295
Joined: Sat Sep 20, 2014 5:26 pm

SQL Cache Dependency in ASP.NET

Postby Ladva Nidhi » Thu Oct 16, 2014 3:05 am

What is SQL Cache Dependency in ASP.NET?


Re: SQL Cache Dependency in ASP.NET

Postby Guest » Fri Jul 31, 2015 10:05 am

SqlCacheDependency class to create a cache item dependency on a table or row in a database. When a change occurs in the table or in a specific row, the item that has a dependency is invalidated and removed from the cache. You can set a dependency on a table in Microsoft SQL Server 7.0, SQL Server 2000, and SQL Server 2005. If you are using SQL Server 2005 you can also set a dependency on a specific record.

Using caching with a SQL dependency can dramatically increase application performance in certain scenarios. For example, imagine you are building an e-commerce application that displays product information from a database. Without caching, your application must request the data from the database each time a user wants to view a product. You could cache the product information for a day at a time, ensuring fast response times because the product information is already in memory. However, if product information changes, the cached product information might then be out of sync with the data for up to a day.

Using SQL cache dependency, you could cache your product information and create a dependency on a database table or row change. When the data changes—and only then—the cache items based on that data are invalidated and removed from the cache. The next time you request that item from the cache, if it is not in the cache, you can re-add the updated version to the cache and be assured that you have the latest data.

Return to “Visual Basic .NET and ASP.NET”

Who is online

Users browsing this forum: No registered users and 1 guest