Cache-BDB

 view release on metacpan or  search on metacpan

t/02-api.t  view on Meta::CPAN


SKIP: {
  skip "db->compact not available", 2  unless 
    ($BerkeleyDB::VERSION >= 0.29 && $BerkeleyDB::db_version >= 4.4);
  # add a bunch of data
  map { $c2->set($_, $_ * rand(int(20))) } (1 .. 12345);

  my $h = $c2->get_bulk();
  is(scalar(keys %$h), $c2->count);
  # and see how big the file is
  my $size_before = (stat(join('/', $options{cache_root}, 
			       'Cache::BDB::02.db')))[7];

  my $count_before = $c2->count();

  # clear it out
  is($c2->clear(), $count_before);

  # and check again.
  my $size_after = (stat(join('/', $options{cache_root},
			      'Cache::BDB::02.db')))[7];

  ok($size_before > $size_after);
}



( run in 1.595 second using v1.01-cache-2.11-cpan-49f99fa48dc )