I'm looking for a real-time counter that updates as more database entries (sales) are created (for example, http://www.humblebundle.com). I'm trying not to put unnecessary strain on the database.
A naive way to do this would just be to ping the database for the sales count every second or so and update the number in real-time with javascript. This'll put way too much strain on the database and is unworkable, but that's the basic effect I'm trying to achieve.
Another way I can think of is to somehow store the sales number in a cache instead of the database, and then adding +1 to this cache every time a sale is made. The counter then gets updated every second with the new value of the cached count. This seems like it might work a lot better, but I don't know specifically how to implement this in Rails.
I'm using Rails 3.1 and jQuery on Heroku, but I'm mostly just looking for a high-level way to do this. Of course, the more details you can provide the better :)