> 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 :-) > > 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 :-) 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?
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 rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.