$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());