[Mapserver-users] Deleting old GIF image files

Thorsten Fischer thfischer at mapmedia.de
Tue Jun 24 06:29:00 EDT 2003


On Tue, 2003-06-24 at 02:36, Antti.Roppola at brs.gov.au wrote:
> Or if you want something more demand driven, I added a few lines
> to the PHP to delete all but the 10 most recent images.
> 
> Unlike a cron job, this will automagically clean up the directory
> more often if required.

This works well for 10 images. But what are you doing when you have 11
requests to your site at the same time? With the 11th call, the script
tries to delete one of the images that might still be in the process of
being delivered. Behaviour and effect should vary from system to system.

'X most recent' could fail quite easily. For a busy system, something
among the lines of 'older than 5 hours' should create fewer problems.

Apart from that, I do not know if the comparison is an expensive
operation or not; if it is, I would rather have it run once on a bigger
bunch of files (cron job) than repeatedly on a smaller number (the
'embedded' solution), especially on a system that is already busy
producing maps.


hth,

thorsten




More information about the mapserver-users mailing list