Subject: | Can't handle Readonly scalar as expire time. |
Hello kroki.
We found a issue related handling Readonly scalar as expire time.
Here is test program.
----------------------------------------
use Readonly;
use Cache::Memcached::Fast;
my $memcached = Cache::Memcached::Fast->new({
servers => [qw<localhost:11211>],
});
Readonly my $x => 3;
$memcached->set(foo => 100, $x);
print "[$x]\n"; #
$memcached->set(bar => 100, $x);
for(1..5){
print "foo[", $memcached->get('foo'), "]\n";
print "bar[", $memcached->get('bar'), "]\n";
sleep(1);
}
----------------------------------------
Value "bar" will expired after 3secs.
But value "foo" will never expired.
I wrote a patch and attached it.
I hope that you accept this patch.
But I'm not sure this is a right way to fix problem.
Best regard.
Subject: | CMF.diff.txt |
--- Fast.xs.org 2010-03-31 12:38:22.000000000 +0900
+++ Fast.xs 2010-03-31 12:38:50.000000000 +0900
@@ -689,7 +689,7 @@
{
/* exptime doesn't have to be defined. */
sv = ST(arg);
- if (SvOK(sv))
+ if (SvOK(sv) || SvMAGICAL(sv))
exptime = SvIV(sv);
}
if (ix != CMD_CAS)