I would definitely not calculate their rank every time you display them.
A simple, and not so performant solution would be to cache post rankings, and once one post's ranking changes, you clear or refresh the cache.
That is not ideal, but it is possible.
Another way would be to do as you alluded to: calculate and store ranks in the database (and ideally cache them), and then refresh those rankings using a cron job every x minutes.
Again, these are basic approaches to what you want to do. You can then build on them over time.
The algorithm you choose will most likely be very particular to your needs.
You need to also gauge what kind of traffic your site would be getting, as it would dictate what kind of lengths you should go through to get the right algorithm.