parameters: (self)
docstring: Increment the value of the counter.
docstring_summary: Increment the value of the counter.
docstring_tokens: Increment the value of the counter .
function: def increment(self):
          """Increment the value of the counter.
          """
          if self.__counter_config is None:
              self.__counter_config = GeneralCounterShardConfig.get_or_insert(self.__counter_name, name=self.__counter_name)
  
          # maintain minimum number of shards
          if self.__counter_config.num_shards < MIN_NUM_SHARDS:
              self.increase_shards(MIN_NUM_SHARDS)
              
          def txn():
              index = random.randint(0, self.__counter_config.num_shards - 1)
              shard_name = self.__counter_name + str(index)
              counter = GeneralCounterShard.get_by_key_name(shard_name)
              if counter is None:
                  counter = GeneralCounterShard(key_name=shard_name, name=self.__counter_name)
              counter.count += 1
              counter.put()
          db.run_in_transaction(txn)
          # does nothing if the key does not exist
          memcache.incr(self.__counter_name)
function_tokens: def increment ( self ) : if self . __counter_config is None : self . __counter_config = GeneralCounterShardConfig . get_or_insert ( self . __counter_name , name = self . __counter_name ) # maintain minimum number of shards if self . __counter_config . num_shards < MIN_NUM_SHARDS : self . increase_shards ( MIN_NUM_SHARDS ) def txn ( ) : index = random . randint ( 0 , self . __counter_config . num_shards - 1 ) shard_name = self . __counter_name + str ( index ) counter = GeneralCounterShard . get_by_key_name ( shard_name ) if counter is None : counter = GeneralCounterShard ( key_name = shard_name , name = self . __counter_name ) counter . count += 1 counter . put ( ) db . run_in_transaction ( txn ) # does nothing if the key does not exist memcache . incr ( self . __counter_name )