Last post Apr 08, 2016 02:11 PM by Xequence
Apr 08, 2016 01:44 PM|Xequence|LINK
When a user is requesting xml files is there a specific method to guarantee that once the file is requested, that all further requests will not need to load the file?
An example is can I use singleton pattern, specifically, to request a file and not have to request the file again during the session.
Phase 2 would be that the singleton instance would only get the file if it has changed.
Apr 08, 2016 01:56 PM|PatriceSc|LINK
Some more context could help. Make sure first what you want to prevent. For now it looks like you are talking rather about server side caching. You could also use client side caching to not even send the file when it is not needed or to combine both if
it's really worth.
I would perhaps suggest to start maybe with https://varvy.com/ifmodified.html
Apr 08, 2016 01:58 PM|Xequence|LINK
current situation is a bakers dozen of business analyst will build xml structures. these structures build html. if I can not rebuild the html because xml did not change I could save some steps, I think...
I don't think prototype pattern with cloning the xml would help since I would still have to look at the xml file again... and then versioning the xml comes into play :/
Apr 08, 2016 02:05 PM|PatriceSc|LINK
So for now it seems you would likely rather to use
https://msdn.microsoft.com/en-us/library/d5da1572.aspx so that you can keep the current HTML file or rebuild the file if the XML file has been changed since the HTML file was built ?
A problem might be that this HTML file is accessed directly?
Also make sure first it would save some time. Try to measure. Else you have a risk of doing something because you think it should be quicker and once done to see that it finally doesn't make any real difference.
Apr 08, 2016 02:11 PM|Xequence|LINK
I am writing everything in a testmethod to give a proof of concept. there is not a physical html file. the only physical piece at the moment is the xml file. I am hoping that it would allow me to get a cached version of the xml if it has not changed. I don't
want to store xml in sql :/
will look into using the GetLastWriteTime. thanks!