Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

c# / ASP.NET / SQL Server - running query once a day

I'm going to be doing a progress bar for a donations page on a website that I run. I only want the progress bar to update once a day, rather than on every page load as I would normally do.

What options do I have here for grabbing the current SUM of donations and putting it maybe in a flat text file for the aspx page to read rather than it querying the database every time.?

Hope this makes sense.

like image 933
MichaelEaton Avatar asked Jun 08 '11 15:06

MichaelEaton


2 Answers

Another option is to use caching and set the cache to only expire once every 24 hours. Then the data is pulled and placed in cache and the cached version is served all day.

like image 64
Gregory A Beamer Avatar answered Sep 29 '22 23:09

Gregory A Beamer


I would just run a SUM query on the database each time. Unless you're expecting millions of row inserts per day, this will be a negligable performance hit. (Providing your database table is indexed)

like image 40
DaveRead Avatar answered Sep 29 '22 23:09

DaveRead