Last post Mar 15, 2012 12:36 AM by Mauro_net
Mar 13, 2012 06:54 AM|Minhajul040182|LINK
I am creating a report based on two asp pages ... In first page, I am formulating data and insert it into DataTabe then store it into Cache for 5 minutes only. and redirect to Another Page to display report. using Cache data.
But here is problem that if other user hit same report and at the same time and report is refreshed by other user then data will be mismatched I think so.
Another way I can store data into Session but it will be very heavy for huge records ....
Can you suggest me what are the best way to create report...
Thanks & Regards
Mar 15, 2012 12:36 AM|Mauro_net|LINK
if the data is not relevant to multiple sessions, you shouldn't store it in a place where it can get overwritten by some other user, that is for starters.
I think it is up to you to store it in a cache or session, after all it is all going into server's memory. I mean... it's the exact same.
You will have to decide if this data is a good candidate for caching, for instance if you need it more than once. I guess if you cleanup properly the memory you should be ok.
I guess your scenario is
- user sees data in html output
- then wants to print report with the same data
so ypu're saying "why should he do the query twice, if i can just store it? "
the best person to asnwer that is you. In case you decide the query is heavy, you'll have also to think how many concurrent users will be using it. Do some calculations. Move it to memory, see how much stace it really consumes. Most of the times you can
actually put it in memory and it will be ok. If all users are doing the same all the time, it will be a problem and maybe you're better off excecuting the query twice.
There are other approaches, you could use temporary tables. You put the query results in a temp table. Then show both html and reports from temporary table. Creating a temporary table could be seen as "caching in db server's disk" So if the query takes too
long, you only excecute it once and then just do a plain select over the temp table. Cleanup as soon as possible.
that's my 50 cent