def get_cache_key(self): """Default cache key Can be overridden by the subclass """ if self._cache_key is None: cache_key_prefix = get_cache_key_prefix() suffix = self.get_cache_key_suffix() self._cache_key = '%s:%s:%s' % (cache_key_prefix, self.__class__.__name__, suffix,) return self._cache_key
def get_cache_key(self, suffix=None): """Default cache key A typical cache key that requires the object to have the attribute `id`: key = 'appid:%s:%s' % (self.__class__.__name__, self.id,) Can be overridden by the subclass """ cache_key_prefix = get_cache_key_prefix() if suffix is None: suffix = self.get_cache_key_suffix() else: pass key = '%s:%s:%s' % (cache_key_prefix, self.__class__.__name__, suffix,) return key