store images in httpcontext.cache

sergio magrì 96 Reputation points
2021-10-03T17:51:33.823+00:00

Hi,
i need an advice. I have a web server A that reads images from the file system and return them to another web server B that needs to return those images to a third web server C. I'm working on web server B.
In order to reduce calls number to web server A (which is very slow) i'm thinking at cahing the images on web server B using httpcontext.Cache. The initial number of images should be about 10,000 and theoretically the number should remain that with new images that would replace the old ones( for every replace also the url to return it will be different). I can't know a priori when there will be a replacement so I was thinking of setting an expire time of 24-48 hours, this because I would not want to saturate the available ram. Initially I thought of using a list of images to be stored in HttpContext.Cache ["images"] but by doing so I don't think I can set the expire time individually (and I think that managing it by myself would be much more complicated than using the expire time native cache. So I should store every single image in a different location, for example httpcontext.cache ["img1"], httpcontext.cache ["img2"] ... etc..
Do you think it might be a good idea? Do you have some other ideas?
My final goal is to reduce the response times of web server B without the risk of blocking the server due to too much use of ram

Thank you
Sergio

Windows for business | Windows Server | User experience | Other
0 comments No comments
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.