Subject: | Expiration does not work with straight numerics |
I found that cache expiration was not working. It was set to a single
day (30*30*24), it does not work. The documentation states:expiration
specification
"Expiration can be specified in seconds, but, for convenience, can also
be specified in days, hours and minutes (and seconds). This is
indicated by a number, immediately followed by a letter D (for days) or
H (for hours) or
M (for minutes) or S (for seconds). For example:
2D3H
means 2 days and 3 hours, which means 183600 seconds."
ONLY the "convenience" designation works. See the modified tests below
along with the result... Note it does not matter if the seconds are
expressed with or without quotes both ways without the letter fail.
# Check expiration
my $value1 ='Fish';
ok( $cache->set( value => $value, expiration => '3s' ),
"Simple value for expiration check" );
is( $cache->get, $value,
"Check if simple getting before expiration works" );
sleep 5;
ok( !defined $cache->get,
"Check if simple getting after expiration fails" );
# check expiration with basic seconds no sdhw
ok( $cache->set( value => $value1, expiration => '3' ),
"Simple value for expiration check" );
is( $cache->get, $value1,
"Check if simple getting before expiration works" );
sleep 5;
ok( !defined $cache->get,
"Check if simple getting after expiration fails" );
[dana@dchandler-ln at 12:49 PM on Tue Sep 22]
<In ~/build/src/p/Cache-Memcached-Managed-0.20 executing command #42 >
make test
PERL_DL_NONLAZY=1 /home/dana/etp/perl/5.10.0/bin/perl
"-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib',
'blib/arch')" t/*.t
t/001basic.......ok 5/179#
# Started memcached server
Use of uninitialized value $line in send at
/home/dana/etp/cpan/5.10.0/p/Cache/Memcached.pm line 373.
t/001basic.......ok 7/179Use of uninitialized value $line in send at
/home/dana/etp/cpan/5.10.0/p/Cache/Memcached.pm line 373.
t/001basic.......ok 37/179
# Failed test 'Check if simple getting after expiration fails'
# at t/001basic.t line 184.
t/001basic.......NOK 127/179
# Failed test 'Check if simple getting after expiration fails'
# at t/001basic.t line 184.
t/001basic.......ok 130/179#
# Stopped memcached server
# Looks like you planned 179 tests but ran 3 extra.
# Looks like you failed 2 tests of 182 run.
t/001basic.......dubious
Test returned status 2 (wstat 512, 0x200)
DIED. FAILED tests 40, 127, 180-182
Failed 5/179 tests, 97.21% okay
--
:: Dana C. Chandler III | Principal E.T.P. Engineer
:: e-Dialog | dchandler@e-dialog.com
:: 65 Network Drive | Burlington, MA 01803
:: v: 781-372-3355 | f: 781-863-8118
:: m: 339-223-1594 | www.e-dialog.com