I have some ASP.NET MVC actions that generate images dynamically (although it is equally an ASPX Page).
I am using [output cache] to cache these images. I'm just thinking that I need to worry about ASP.NET caching images in memory and have many resources to take. These are product sizes of different sizes for a shopping cart, which includes only two dozen products.
Will the output use the capture disc or just in memory? How intelligent it is? Or should I just save the images automatically from the disk and implement my own caching system (which is actually the current implementation)?
For all purposes and purposes, I believe the output cache is completely in memory - whose This means that if the App Pool is recycled, then the image will need to be re-generated.
I had to do something like this in the past, and I actually implemented a two-level system that primarily used HTTP cache, and used the file system as a fallback. If something was not present, then I created the image and saved it to disk and put it in the cache. In this way, if this cash or the Ape Pool is recycled, then I only need to load it from the disk (it appears that you have done this).
As far as "too much memory", if you explicitly use HttpContext.Cache instead of [OutputCache], you can control the priority of the item in the cache. You can then control the settings of your app pool, how much memory it uses, but I'm not sure anything other than it should be done. Some images * 12 products do not look like it will take a lot of memory for me.
Without knowing anything about your application, it seems to me that you may still be away from using Outputcache However, if you need something more robust and scalable, then I I use a two-level system that I described. However, if you have already implemented and worked, "if it does not break ..."
Comments
Post a Comment