收录日期:2019/12/09 07:42:56 时间:2010-10-28 14:21:01 标签:asp.net,sql,caching,outputcache,webusercontrol

You know I have the way to Cache the data I've got from the SQL Server over data caching. In addition I can output cache web user controls.

Whats about a web user control contains data from a SQL database? Does it make sense to cache the data and also cache the control?

What is the best solution for the combination of these two components?

Yes. this is a newbie question.

If you cache the control, then you don't need to cache the underlying data. Optimal caching, as always, depends on your application.

Here are some general guidelines:

Use data caching for complex, CPU/Memory intensive queries, for data that is used very often on different pages/controls.

Use output caching for controls that appear often. Output caching also tends to be simpler to implement compared to data caching with requires more thought concerning threading/locking, etc.