Handling temporary generated image/graphs

Hi,

I have an application where I based on users selections generate a
dataset for them to download and a graph describing this data. The
graph is made with gnuplot and work really well - no problems :slight_smile:

But I save the graph to a file say “graph.png” in the public/images
dir and use it in the view. I have a strong felling that when more
than one user is generating graphs I will have a problem, since
they’ll keep overwriting the same graph again and again.

I realize that I could add some sort of session id or time stamp to
the image, but I don’t want to fill my server with abandoned images
and the users are not likely to request the same image/graph again any
time soon.

Is there any concept like a temp store where all files more than 5
mins (or 1 day, don’t matter :slight_smile: old are deleted, or a round robin
scheme where abandoned filenames get recyled.

Have I missed some vital function, - or is it just a matter of a cron
job to clean up after a hard days job?

regards
Jan

–

You received this message because you are subscribed to the Google
Groups “Ruby on Rails: Talk” group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.

job to clean up after a hard days job?
Probably easiest to have cron do it. Make sure the filenames are
unique – combo of user’s login and a timestamp say, then have your
cron job use ‘find’ to find old files and delete them. Run it every
hour or whenever necessary.

–

You received this message because you are subscribed to the Google
Groups “Ruby on Rails: Talk” group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.