changeset 953:8647a669edb4

Fix excessive cache usage for forum date/times. Issue #84. Hitting the cache 30+ times while browsing the forums to adjust all the dates/times into the user's time zone. Just hit the user's profile and be done with it. It should be loaded.
author Brian Neal <bgneal@gmail.com>
date Tue, 19 May 2015 21:08:45 -0500
parents 5366c29d6dce
children e56455f4626b 6cc9221d04a7
files forums/templatetags/forum_tags.py
diffstat 1 files changed, 2 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/forums/templatetags/forum_tags.py	Sat May 16 18:51:12 2015 -0500
+++ b/forums/templatetags/forum_tags.py	Tue May 19 21:08:45 2015 -0500
@@ -61,18 +61,9 @@
     """
     Return the supplied user's time preferences in the form of a 2-tuple:
         (use_24_time, time_zone_name)
-
-    These preferences are cached to reduce database hits.
-
     """
-    cache_key = '%s_tz_prefs' % user.username
-    tz_prefs = cache.get(cache_key)
-    if tz_prefs is None:
-        profile = user.profile
-        tz_prefs = profile.use_24_time, profile.time_zone
-        cache.set(cache_key, tz_prefs)
-
-    return tz_prefs
+    profile = user.profile
+    return profile.use_24_time, profile.time_zone
 
 
 @register.simple_tag