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.
精彩评论