DataTable caching performance - Online Free Computer Tutorials.

'Software Development, Games Development, Mobile Development, iOS Development, Android Development, Window Phone Development. Dot Net, Window Services,WCF Services, Web Services, MVC, MySQL, SQL Server and Oracle Tutorials, Articles and their Resources

Tuesday, April 24, 2012

DataTable caching performance

In many programs, the SqlDataAdapter.Fill method is used to retrieve data from a database and store in aDataSet. Tables that are accessed frequently, but are changed rarely, could be stored in memory for faster data access. The MemoryCache class provides the Add method with which any object may be added under some key. In this project, DataTables are added to the MemoryCache. When a record is to be retrieved from a table, it is checked if the table exists in the cache. If it exists, the DataTable is retrieved from the cache, otherwise it is retrieved from the database and stored in the cache. The record in the DataTable is found using DataView'sRowFilter property.

No comments:

Post a Comment