Cache-RedisDB
view release on metacpan or search on metacpan
);
my $now2 = Cache::RedisDB->get("Date", "Utility");
eq_or_diff [$now2->year, $now2->month, $now2->second, $now2->timezone], \@now_exp, "Got correct Date::Time object from cache";
}
is(Cache::RedisDB->get("NonExistent", "Key"), undef, "Got undef value for non-existing key");
ok(Cache::RedisDB->set("This", "expires", "In a second", 1), "Set with expire");
ok(Cache::RedisDB->set("Even this", "é®", "Oops...", 0.5), "Spaces and utf8 in keys are Ok");
is(Cache::RedisDB->get("Even this", "é®"), "Oops...", "Got value for unicode key");
sleep 1;
is(Cache::RedisDB->get("Even this", "é®"), undef, "unicode key value expired in 1s");
cmp_ok(Cache::RedisDB->ttl('Test', 'TTL'), '<=', 59, 'Our TTL key still exists and expiring in the future');
cmp_ok(Cache::RedisDB->ttl('Test', 'TTL2'), '==', 0, 'Our non-existent TTL key expires "now"');
$cache->set("Test::Number", -33);
is(Cache::RedisDB->get("Test", "Number"), -33, "Got negative number from cache");
ok(Cache::RedisDB->set("Test", "Num2", -55), "Set negative number");
is($cache->get("Test::Num2"), -55, "It is stored as number");
subtest 'JSON' => sub {
plan tests => 6;
( run in 0.401 second using v1.01-cache-2.11-cpan-88abd93f124 )