app/soc/cache/home.py
changeset 2871 e440e94a874b
parent 2869 1ac6a1e1e429
child 2879 cb0f9b4646aa
equal deleted inserted replaced
2869:1ac6a1e1e429 2871:e440e94a874b
    25 import logging
    25 import logging
    26 
    26 
    27 from google.appengine.api import memcache
    27 from google.appengine.api import memcache
    28 
    28 
    29 from soc.logic import accounts
    29 from soc.logic import accounts
    30 from soc.logic import system
       
    31 
    30 
    32 import soc.cache.base
    31 import soc.cache.base
    33 
    32 
    34 
    33 
    35 def key(entity):
    34 def key(entity):
    36   """Returns the memcache key for an entities homepage.
    35   """Returns the memcache key for an entities homepage.
    37   """
    36   """
    38 
    37 
    39   host = system.getHostname()
    38   return 'homepage_for_%s_%s' % (entity.kind(), entity.key().id_or_name())
    40   version = system.getAppVersion()
       
    41   kind = entity.kind()
       
    42   key = entity.key().id_or_name()
       
    43 
       
    44   return 'homepage_for_%s_%s_%s_%s' % (host, version, kind, key)
       
    45 
    39 
    46 
    40 
    47 def get(self, *args, **kwargs):
    41 def get(self, *args, **kwargs):
    48   """Retrieves the homepage for the specified entity from the memcache.
    42   """Retrieves the homepage for the specified entity from the memcache.
    49   """
    43   """