Class-Simple-Cached
view release on metacpan or search on metacpan
t/integration.t view on Meta::CPAN
# Second getter â inner object must NOT be called again (cache hit).
my $pre_count = $inner->call_count();
$obj->colour();
is($inner->call_count(), $pre_count,
'hash:lifecycle: second getter does not invoke the inner object');
diag sprintf('[hash:lifecycle] store keys: %s', join(', ', sort keys %store))
if $ENV{TEST_VERBOSE};
# DESTROY fires when $obj goes out of scope; use a block to force it.
{ my $tmp = $obj; } # keeps $obj alive; we destroy via explicit undef
$obj = undef;
is(scalar(keys %store), 0,
'hash:lifecycle: DESTROY removes all cache entries from the hash ref');
done_testing();
};
# âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
# Workflow 2 â Optional CHI dependency
( run in 2.690 seconds using v1.01-cache-2.11-cpan-14f38c9f855 )