main.py 文件源码

python
阅读 17 收藏 0 点赞 0 评论 0

项目:appbackendapi 作者: codesdk 项目源码 文件源码
def get_greetings(self, guestbook_name):
        """
        get_greetings()
        Checks the cache to see if there are cached greetings.
        If not, call render_greetings and set the cache

        Args:
          guestbook_name: Guestbook entity group key (string).

        Returns:
          A string of HTML containing greetings.
        """
        greetings = memcache.get('{}:greetings'.format(guestbook_name))
        if greetings is None:
            greetings = self.render_greetings(guestbook_name)
            if not memcache.add('{}:greetings'.format(guestbook_name),
                                greetings, 10):
                logging.error('Memcache set failed.')
        return greetings
    # [END check_memcache]

    # [START query_datastore]
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号