Removed caching for dev machines

This commit is contained in:
Piotr Mitros
2012-03-10 20:13:03 -05:00
parent a8c2c3c5b4
commit a2c4010b8f
3 changed files with 13 additions and 1 deletions

View File

@@ -151,7 +151,13 @@ def user_groups(user):
# TODO: Rewrite in Django
key = 'user_group_names_{user.id}'.format(user=user)
cache_expiration = 60 * 60 # one hour
group_names = cache.get(fasthash(key))
# Kill caching on dev machines -- we switch groups a lot
if "dev" not in setting.DEFAULT_GROUPS:
group_names = cache.get(fasthash(key))
else:
group_names = None
if group_names is None:
group_names = [u.name for u in UserTestGroup.objects.filter(users=user)]
cache.set(fasthash(key), group_names, cache_expiration)