comparison gpp/forums/management/commands/update_forum_stats.py @ 395:e10fa0d8e7ad

Fixing #192; cache some forum stats and have them be computed outside of the request/response cycle. Update the template tag to just read the cache.
author Brian Neal <bgneal@gmail.com>
date Fri, 25 Mar 2011 00:27:10 +0000
parents
children
comparison
equal deleted inserted replaced
394:2cb0cc334c50 395:e10fa0d8e7ad
1 """
2 update_forum_stats.py - A management command to calculate and update the
3 cache with the forum statistics. These are done out of the request /
4 response cycle because doing a count on the Post table is expensive
5 under MySQL and InnoDb.
6
7 """
8 from django.core.management.base import NoArgsCommand, CommandError
9
10 from forums.stats import update_stats
11
12
13 class Command(NoArgsCommand):
14 help = "Calculates and updates the cache with forums statistics"
15
16 def handle_noargs(self, **opts):
17 update_stats()