Background
I have an SQL CE database, that is constantly updated (every second).
I have a (web) application that allows a user to look at the data in real-time. At some point a user can click "take a snapshot" button, and it will open the snapshot in a different window.
And then on that form, there is "print" and "download" buttons that will either generate a page for printing, or will stream the data as CSV file - but same data snapshot has to be used, i.e. I can't go to the DB to get latest data for that.
Details
- SQL CE dabatase is exposed through WCF web service.
- Snapshot consists of up to 500 records, 10 columns each. Expiration time on the snapshot of 2 hours is sufficient.
- It is a low-traffic application, so I don't expect more than few (5) connections at the same time.
- Loosing snapshot is not a big deal, user can simply generate new one.
- database is accessed by self-hosted WCF web service using Linq-to-SQL.
- Web site is ASP.NET MVC hosted on UltiDev Cassini.
- database, and web site are most likely be on the same box, when deployed. The entire app is intranet bound.
Problem I need to cache the snapshot of the data at the moment user pressed "take a snapshot" button, so that I can use same data to generate print page, or generate a file for download.
Solution 1: Each time there is a need to generate a snapshot, I will create a table in the database. Since there are no temp tables in SQL CE, I will need to clean it up myself.
Solution 2: Cache the snapshot in-memory on either DB server, or web server.
Question: Is there anything wrong with proposed solutions? Any different solution suggestions?