protected static $modules =
['system'
];
/**
* Tests garbage collection.
*/
public function testGarbageCollection() { $collection =
$this->
randomMachineName();
$connection = Database::
getConnection();
$store =
new DatabaseStorageExpirable($collection,
new PhpSerialize(),
$connection);
// Insert some items and confirm that they're set.
for ($i = 0;
$i <= 3;
$i++
) { $store->
setWithExpire('key_' .
$i,
$this->
randomObject(),
rand(500, 100000
));
} $this->
assertCount(4,
$store->
getAll(), 'Four items were written to the storage.'
);
// Manually expire the data.
for ($i = 0;
$i <= 3;
$i++
) { $connection->
merge('key_value_expire'
) ->
keys([