def to_cache(self): mapping = { 'slug': self.slug, 'user_list': [], 'channels': [], } cache.hmset(self.cache_key, mapping)
def to_info(self): mapping = { 'slug': self.slug, 'name_en': self.name_en, 'name_zh': self.name_zh, 'author_slug': self.author_slug, 'description': self.description } cache.hmset(self.cache_key, mapping)