1

I have a MetaTags table on a MS-SQL database. The Master page of my site reeds this info everytime a page is load.

I'd like to use a ASP.NET cache object in order to improve performance, so I don't have to access the db everytime.

Someone gave me the idea of using a time based expiration cache and also a sql based expiration trigger.

Could someone please help me to decide which aproach is better and give me an example of some lines of code to develop it?

Thanks a lot.

2
  • Do you have a performance problem? MSSQL will also cache the data (automatically). How have you tested your performance problem if you're having any. How many users does it take for the performance problme to show. Caching is not a magic bullet and nor will it always improve performance. Stay with what you have, and maybe ensure that your query well optimized and your database design is well suited for the need. Those two can give me far better performance improvements. Commented Feb 24, 2011 at 10:56
  • You may also want to look at getting the data for the Master page along with other queries rather than querying your database multiple times for each request (as it seems to be currently Commented Feb 24, 2011 at 11:00

1 Answer 1

2

It sounds like they are describing the SqlCacheDependencyclass SqlCacheDependency MSDN Article

You could also just repopulate the cache yourself when the item expires. Notify an Application When an Item Is Removed from the Cache

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.