Example #1
0
    def get_count(name):
        """Retrieve the value for a given sharded counter.

        Parameters:
          name - The name of the counter
        """
        total = memcache.get(name)
        if total is None:
            total = 0
            for counter in GCounter.all().filter('name = ', name):
                total += counter.count
            memcache.add(name, total, 60)
        return total