Skip to content

Commit

Permalink
PD patrons use separate homepage cache
Browse files Browse the repository at this point in the history
  • Loading branch information
mekarpeles committed Feb 11, 2021
1 parent 09a86eb commit a902124
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion openlibrary/plugins/openlibrary/home.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,12 @@ def get_homepage():
def get_cached_homepage():
five_minutes = 5 * dateutil.MINUTE_SECS
lang = web.ctx.get("lang", "en")
pd = web.cookies().get('pd', False)
key = "home.homepage." + lang
if pd:
key += '.pd'
return cache.memcache_memoize(
get_homepage, "home.homepage." + lang, timeout=five_minutes)()
get_homepage, key, timeout=five_minutes)()

class home(delegate.page):
path = "/"
Expand Down

0 comments on commit a902124

Please sign in to comment.