locked
Database caching - which is the best way to implement it? RRS feed

  • Question

  • User-758219241 posted

    Hi,

    I am writing an ASP.NET MVC application, and I would like to implement database caching. My objective is detailed as below -

    - There is one stored procedure which retrieves data from database, and presents them to the screen.

    - The resultset is presented as a multi-columner list in my page, and it has Edit button.

    - Now when user clicks on "Edit" button, I would like my application to get that row from database only if at least one of the column been changed, otherwise, I want the cached data to be used that will be presented in Edit form. Because I want minimum round-trips and database operations.

    What is the best way to achieve this?

    Do let me know if anything above does not make sense.

    Any suggestions, Much Appreciated

    Thanks

    Monday, August 8, 2011 11:46 AM

Answers

All replies

  • User-1856974186 posted

    One way to do this would be to use the Cache object and a SqlCacheDependency, which ensures that the data is evicted from the cache if it has changed in the database. Have a search for "asp.net data caching sqldependency" and you'll get a ton of articles that should help.

    Tuesday, August 9, 2011 6:11 AM
  • User-481631678 posted

    You can use Cache Dependency to resolve your problem, for details see:-


    http://www.asp.net/data-access/tutorials/using-sql-cache-dependencies-vb

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, August 12, 2011 5:07 AM