# HG changeset patch # User Brian Neal # Date 1432087725 18000 # Node ID 8647a669edb443a2a8a12c8dfd5dba86809a7758 # Parent 5366c29d6dcefdce5781e59420cced7a12771297 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. diff -r 5366c29d6dce -r 8647a669edb4 forums/templatetags/forum_tags.py --- 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