Let us know how many records we're working with.  Check if ``$this->set()`` already before telling us to save yourself a query.

@param int $count
434308
public function total($count)
    {
        if ($this->get) {
            $this->total = ($count > $this->limit) ? ceil($count / $this->limit) : 1;
        }
    }
877341
public function countBySubQuery($conditions = false)
    {
        $this->andWhere($conditions);
        return (int)$this->db->fetchColumn($this->getSqlForCount(), $this->params);
    }
385105
public function decrementCount($tag, $count)
	{
		if($count <= 0) { return; }

		$tag->count = $tag->count - $count;
		if($tag->count < 0) {
			$tag->count = 0;
			$model = $this->tagModelString();
			\Log::warning("The '.$model.' count for `$tag->name` was a negative number. This probably means your data got corrupted. Please assess your code and report an issue if you find one.");
		}
		$tag->save();
	}
612500
public function increase( $count = 1 )
    {
        // The attribute is naively incremented, despite possible updates in the DB.
        $this->setAttribute( 'count', $this->attribute( 'count' ) + $count );
        // However, we are not using ->store() here so that we atomatically update
        // the value of the counter in case it has been updated in parallel.
        eZDB::instance()->query(
            "UPDATE ezview_counter " .
            "SET count = count + " . (int)$count . " " .
            "WHERE node_id=" . $this->attribute( "node_id" )
        );
    }
522336
public function seeElementCount($selector, $count)
    {
        $this->assertCount($count, $this->crawler->filter($selector));

        return $this;
    }
212537
private function determineCount($items, &$count, $idList)
    {
        $usedOptionsIdList = \array_unique(\array_filter(\array_map(
            function ($item) {
                /** @var IItem $item */
                return $item->get('id');
            },
            \iterator_to_array($items)
        )));

        if (empty($usedOptionsIdList)) {
            return;
        }

        $valueCol = $this->getColName();
        $query    = $this->connection->createQueryBuilder()
            ->select($this->getColName())
            ->addSelect(\sprintf('COUNT(%s) AS count', $this->getColName()))
            ->from($this->getMetaModel()->getTableName())
            ->where($this->getColName() . ' IN (:ids)')
            ->groupBy($this->getColName())
            ->setParameter('ids', $usedOptionsIdList, Connection::PARAM_STR_ARRAY);
        if ($idList !== null && !empty($idList)) {
            $query
                ->andWhere('id IN (:idList)')
                ->setParameter('idList', $idList, Connection::PARAM_STR_ARRAY);
        }
        $query = $query->execute();

        while ($row = $query->fetch(\PDO::FETCH_ASSOC)) {
            $count[$row->{$valueCol}] = $row->count;
        }
    }
1214632
public function up ( $count = 0 ) {
        $this->_currentPosition = array(
                                        $this->_currentPosition[0],
                                        $this->_currentPosition[1] - $count,
                                       );
        return $this;
    }
1339020
public void setCounts(Collection<E> keys, int count) {
    for (E key : keys) {
      setCount(key, count);
    }
  }
500743
public function count($stat_key, $count = 1)
    {
        if (! isset($this->config['user_key'])) {
            throw new Exception('StatHat user key not set.');
        }

        $this->post('c', ['ukey' => $this->config['user_key'], 'key' => $stat_key, 'count' => $count]);
    }
450416
public function spop($key, $count = 1)
    {
        $this->init();
        if ($count == 1 || $count === null) {
            $result = $this->driver->spop($key);
            return $this->convertFalseToNull($result);
        }

        $members = [];
        for ($i = 0; $i < $count; ++$i) {
            $member = $this->driver->spop($key);
            if (!$member) {
                break;
            }
            $members[] = $member;
        }
        return empty($members) ? null : $members;
    }
7093
public function hitLimits($region, $count = 1)
	{
		foreach ($this->limits as $limit)
		{
			if ($limit->getRegion() == $region &&
				! $limit->hit($count)
			)
			{
				return false;
			}
		}

		return true;
	}
404804
public function readRecords($count = 10)
    {
        $result = $this->getRecords($this->offset, $count);
        $this->offset += count($result);

        return $result;
    }
48730
public function takeFirst(int $count)
    {
        return $this->wrap(function (Iterator $data) use ($count) {
            $first = true;

            while ($count-- && $data->valid()) {
                if (!$first) {
                    $data->next();
                }

                yield $data->key() => $data->current();
                $first = false;
            }
        });
    }
863057
public function countByQuery($query)
    {
        $queryCount = clone $query;
        $queryCount->setCols('count(*) as count');
        $result = $this->getDB()->execute($queryCount);

        if ($result->numRows()) {
            $row = $result->fetchResult();

            return (int)$row['count'];
        }

        return false;
    }
443624
public function incrementPosition($count = 1)
    {
        if ($this->isNotInList()) return $this;

        $this->setListifyPosition($this->getListifyPosition() + $count);

        return $this;
    }
300041
public function limit($count, $offset = 0)
    {
        $this->limit = array((int) $count, (int) $offset);

        return $this;
    }
446552
public function setParcelCount($count)
    {
        $this->set(Config::T8905, (string)$count);
        $this->set(Config::T8702, (string)$count);

        return $this;
    }