modelcounter.py 文件源码

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

项目:enkiWS 作者: juliettef 项目源码 文件源码
def get_count(name):
    """Retrieve the value for a given sharded counter.

    Args:
        name: The name of the counter.

    Returns:
        Integer; the cumulative count of all sharded counters for the given
            counter name.
    """
    total = memcache.get(name)
    if total is None:
        total = 0
        all_keys = GeneralCounterShardConfig.all_keys(name)
        for counter in ndb.get_multi(all_keys):
            if counter is not None:
                total += counter.count
        memcache.add(name, total, 60)
    return total
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号