Jump to content

Making a .xml file expire.. necessaary?


physaux

Recommended Posts

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? :confused:

 

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!!

Link to comment
https://forums.phpfreaks.com/topic/182029-making-a-xml-file-expire-necessaary/
Share on other sites

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

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.