summaryrefslogtreecommitdiffstats
path: root/t/cache.t
diff options
context:
space:
mode:
Diffstat (limited to 't/cache.t')
-rw-r--r--t/cache.t13
1 files changed, 7 insertions, 6 deletions
diff --git a/t/cache.t b/t/cache.t
index 1a52b45..9e7b80d 100644
--- a/t/cache.t
+++ b/t/cache.t
@@ -14,7 +14,11 @@ BEGIN
or plan skip_all =>
"DBD::CSV is needed for this test";
- plan tests => 10;
+ eval { require Cache::Memcached; }
+ or plan skip_all =>
+ "Cache::Memcached is needed for this test";
+
+ plan tests => 7;
unlink('baz_table') if ( -e 'baz_table' );
unlink('bar_table') if ( -e 'bar_table' );
@@ -37,17 +41,14 @@ BEGIN
ok(Bar->cache(1),'setting cache');
ok(4 == Bar->retrieve_all(),'retrieve all objects');
-ok(4 == scalar keys %{$Jaos::DBI::cache->{'Bar'}},'check cache is populated');
+ok(4 == scalar keys %{$Jaos::DBI::cache->get_multi( qw/Bar:1 Bar:2 Bar:3 Bar:4/ )},'check cache is initially populated');
# extract our baz objects into the cache
$_->baz foreach Bar->retrieve_all();
-ok(2 == scalar keys %{$Jaos::DBI::cache},'Count objects cached');
-ok(4 == scalar keys %{$Jaos::DBI::cache->{'Bar'}},'count cached Bar objects');
-ok(4 == scalar keys %{$Jaos::DBI::cache->{'Baz'}},'cached Baz objects');
+ok(8 == scalar keys %{$Jaos::DBI::cache->get_multi( qw/Bar:1 Bar:2 Bar:3 Bar:4 Baz:1 Baz:2 Baz:3 Baz:4/ )},'check cache is populated');
ok(!Bar->cache(0),'unsetting cache');
-ok(0 == scalar keys %{$Jaos::DBI::cache->{'Bar'}},'check cache is not populated');
END
{