my $old_cache_count = $db->cache_count(); my $data = $db->fetch('known key 1'); ok( $data, 'expected value for key 1' ); # we expect that to have caused a cache load my $new_cache_count = $db->cache_count(); ok( $new_cache_count, $old_cache_count + 1 ); $old_cache_count = $new_cache_count; $data = $db->fetch('known key 2'); ok( $data, 'expected value for key 2' ); # the cache shouldn't have reloaded ok( $db->cache_count(), $old_cache_count );