Need advice in implementing ASP.NET custom output cache
My website is similar like blog where page content will not change frequently. So i decided to to use page output cache.
But when i turned it on output cache for every page and set the cache duration for 1 hour, my web-hosting provided suspended my site as it is usi开发者_如何学编程ng extensive system memory. After that i re-set the duration to 2 mins, but some times i'm getting database connection timeout errors.
For better performance, anyway i need to caching, but not to cache in the memory. so i came with following idea. please advice whether it is best approach or have any better solutions than this?
I want to write HTTP Module where it intercept all requests. If cache version for specific request is not there, then it writes the page response (using filters write) to disk as file, otherwise sends this file as response.
target framework is 2.0
If you're in ASP.NET 4.0, then you don't need to write this as a HttpModule - output caching is provider-based, you can just write a new provider and plug it in. Gunnar Peipman has a great blog here on writing a file-based output cache provider.
精彩评论