getNumRows example

$backend->set($cid_short$cached_value_short);
    $this->assertSame($cached_value_short$backend->get($cid_short)->data, "Backend contains the correct value for short, non-ASCII cache id.");
  }

  /** * Tests the row count limiting of cache bin database tables. */
  public function testGarbageCollection() {
    $backend = $this->getCacheBackend();
    $max_rows = static::$maxRows;

    $this->assertSame(0, (int) $this->getNumRows());

    // Fill to just the limit.     for ($i = 0; $i < $max_rows$i++) {
      // Ensure that each cache item created happens in a different millisecond,       // by waiting 1 ms (1000 microseconds). The garbage collection might       // otherwise keep less than exactly 100 records (which is acceptable for       // real-world cases, but not for this test).       usleep(1000);
      $backend->set("test$i", $i);
    }
    $this->assertSame($max_rows$this->getNumRows());

    
private function makeTbodyForShowAllTables(array $tables): array
    {
        $this->removeDBPrefix();

        foreach ($tables  as $id => $tableName) {
            $table = $this->db->protectIdentifiers($tableName);
            $db    = $this->db->query("SELECT * FROM {$table}");

            $this->tbody[] = [
                $id + 1,
                $tableName,
                $db->getNumRows(),
                $db->getFieldCount(),
            ];
        }

        $this->restoreDBPrefix();

        if ($this->sortDesc) {
            krsort($this->tbody);
        }

        return $this->tbody;
    }
Home | Imprint | This part of the site doesn't use cookies.