G
Greg Collins [MVP]
Hi, I couldn't find what I was looking for by searching the newsgroup, but perhaps these have already been discussed somewhere. This is a bit long with a lot of interrelated questions.
What I've got is a decodeImage.aspx page that gets called to decode base64 encoded images and return them as displayable images to a Web page. The ASPX page is passed two parameters, "file" and "img". The "file" parameter specifies and XML file on the Web server that contains data including base64 encoded images. The "img" parameter specifies an index to identify which image should be encoded and returned. There could be any number of images to be decoded in the XML file, and their size is also uncertain.
My concern is that if a particular page calls this decodeImage.aspx page numerous times that I am wasting valuable time and efforts by having the XML file loaded each and every time. If I am wrong and this file is not reloaded each time, please let me know, but it's my understanding it will be loaded each time.
So what I was thinking was to cache as an Application variable in the XmlNodeList that was populated with a call to SelectNodes, and name the variable based on the "file" parameter. Then if I find that the variable already exists, use the cached object instead of reloading. Since these images are used site wide, I didn't think a Session variable was appropriate. There can be any number of XML files used, so there could be any number of Application variables that need to be set.
That seems fairly straightforward, but I have a few concerns with that:
1. Can I store the XmlNodeList object and restore it for use the next time?
a. If not, is there any advantage to storing the XML in the variable over having it reloaded?
2. What is the max size for an Application variable?
3. What is the max size for all Application variables together?
4. What actually happens when that size limit has been reached?
5. Once each image have been decoded, are they cached on the server for the Web page to use, or will the Web page always and forever call in to redecode the image each time?
a. If so, I'd like to know my alternatives.
b. If not, how do I know when to release that variable?
6. How do I find out when the XML file has been updated so that I know to update the Application variable?
I think that about covers it. If I think of anything else related to this scenario, I'll do a followup post.
Thanks ahead of time for your help!
What I've got is a decodeImage.aspx page that gets called to decode base64 encoded images and return them as displayable images to a Web page. The ASPX page is passed two parameters, "file" and "img". The "file" parameter specifies and XML file on the Web server that contains data including base64 encoded images. The "img" parameter specifies an index to identify which image should be encoded and returned. There could be any number of images to be decoded in the XML file, and their size is also uncertain.
My concern is that if a particular page calls this decodeImage.aspx page numerous times that I am wasting valuable time and efforts by having the XML file loaded each and every time. If I am wrong and this file is not reloaded each time, please let me know, but it's my understanding it will be loaded each time.
So what I was thinking was to cache as an Application variable in the XmlNodeList that was populated with a call to SelectNodes, and name the variable based on the "file" parameter. Then if I find that the variable already exists, use the cached object instead of reloading. Since these images are used site wide, I didn't think a Session variable was appropriate. There can be any number of XML files used, so there could be any number of Application variables that need to be set.
That seems fairly straightforward, but I have a few concerns with that:
1. Can I store the XmlNodeList object and restore it for use the next time?
a. If not, is there any advantage to storing the XML in the variable over having it reloaded?
2. What is the max size for an Application variable?
3. What is the max size for all Application variables together?
4. What actually happens when that size limit has been reached?
5. Once each image have been decoded, are they cached on the server for the Web page to use, or will the Web page always and forever call in to redecode the image each time?
a. If so, I'd like to know my alternatives.
b. If not, how do I know when to release that variable?
6. How do I find out when the XML file has been updated so that I know to update the Application variable?
I think that about covers it. If I think of anything else related to this scenario, I'll do a followup post.
Thanks ahead of time for your help!