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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.