physaux Posted November 18, 2009 Share Posted November 18, 2009 Hey guys, I am using php to write a xml file on my server, that is then read in a flash file. I noticed my changes were not appearing, so after some research I decided that every time I update my xml file, I "timestamp" the name, which forces the user to always download the most recent one. My question is, are the old ones going to "build up" and be a problem, if I don't set them to expire some time? Here is the code that makes the unique file name: $name = "data_".md5(time()).".xml"; I then update the "pointer" in my html output, to point to the new xml file as the resource. This is working great. but yea, do I need to do expire stuff, or will the browser handle that for me? thanks! EDIT: I think I should mention the size of the xml is 36kb, and At most it would be updating once per 15 minutes EDIT2: Oh yea and if it is a good idea, could someone tell me how too? thanks!! Quote Link to comment https://forums.phpfreaks.com/topic/182029-making-a-xml-file-expire-necessaary/ Share on other sites More sharing options...
mikesta707 Posted November 18, 2009 Share Posted November 18, 2009 Well, since you MD5 the value of the timestamp, it becomes meaningless. If you didn't md5 it you could set up a CRON to get all the file names, extract the number (time()) and order them. then you could delete the bottom 3/5/7 or however many. Alternatively you can just delete the old file when you create a new file, or put them in some sort of archive. Whether or not it will become a problem depends on how often you update the file, and how big the files are Quote Link to comment https://forums.phpfreaks.com/topic/182029-making-a-xml-file-expire-necessaary/#findComment-960129 Share on other sites More sharing options...
salathe Posted November 18, 2009 Share Posted November 18, 2009 It sounds more like some Flash-related problem than anything requiring writing (and managing) multiple files. Quote Link to comment https://forums.phpfreaks.com/topic/182029-making-a-xml-file-expire-necessaary/#findComment-960135 Share on other sites More sharing options...
physaux Posted November 18, 2009 Author Share Posted November 18, 2009 My concern is not about storing them on the server, I have them all in a folder and the folder is emptied every 5 files that I create. I make the name unique only so that the users browser doesnt say "oh I already have this file", and show an old version. I did not put "nocache", because I do want a cache when the file name hasn't changed, but I want the cache ignored when there is an update, so that is why I change the file name. My quesiton had to do with the browser (or flash)? storing the xml files. What were to happen if I kept loading new ones each time they refreshed my page (it won't be that fast). I just don't want a "memory leak" issue. But I am sure browsers automatically delete cached xml files that haven't been used for a while, but I just wanted to check with you guys. Quote Link to comment https://forums.phpfreaks.com/topic/182029-making-a-xml-file-expire-necessaary/#findComment-960147 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.