开发者

What is the best way to cache database query on asp.net-mvc website for performance? [duplicate]

开发者 https://www.devze.com 2023-03-10 04:04 出处:网络
This question already has answers here: Closed 11 years ago. Possible Duplicate: Caching in asp.net-mvc i have an asp.net-mvc site and i am running an expensive database query, where the r
This question already has answers here: Closed 11 years ago.

Possible Duplicate:

Caching in asp.net-mvc

i have an asp.net-mvc site and i am running an expensive database query, where the results rarely change, so i wanted to adding caching, so when other users bring up the same web page it doesn't go开发者_如何学JAVA out to the db but just grabs from this cache. (and maybe forced a db get on some expiration timeframe . .)

i have used syscache before to do this 2nd level caching across different users, when i was using nhibernate but (for other reasons not worth discussing) i can't use nhibernate in this case.

I wanted to replicate that same behavior from what i am getting with nhibernate syscache (2nd level cache) in a scenario without nhiberate.

Is this possible and are there recommended solutions for this. I only have a single web server so i don't need to deal with any distributed issues.


Memcached is a good solution. It basically is a key/value dictionary that runs in memory as a separate process. You can check the cache first, then grab from the database if it has expired.

0

精彩评论

暂无评论...
验证码 换一张
取 消