Quoting Scott Olmsted <[email protected]>:
> 
> I'm creating an application that displays a table of information 
> based on user input. It is time-expensive to create the data for the table.
> 
> The user can, after seeing the HTML table, click on a 'Download' link 
> and receive the data in CSV form.
> 
> I don't want to compute the data again. Is there a way to persist the 
> data without putting it in the database? It could be too large to fit 
> in the session, so that's out.

How easy would it be to pull the data and then create both sets of
output at the same time? If the table is one giant datastructure (not
a bunch of separate chunks), you might be able to hold the data in
memory, build the html, and then write the csv file to the file
system. You'll end up creating some csv files that are never
downloaded - but in the cases where the output is approved and the
user wants the download, it is precomputed. You could have a cron job
clear the cache after an hour so you don't accumulate unwanted files.

--~--~---------~--~----~------------~-------~--~----~
SD Ruby mailing list
[email protected]
http://groups.google.com/group/sdruby
-~----------~----~----~----~------~----~------~--~---

Reply via email to