<html>
<head>
<style>
P
{
margin:0px;
padding:0px
}
body
{
FONT-SIZE: 10pt;
FONT-FAMILY:Tahoma
}
</style>
</head>
<body><DIV><FONT face=Arial size=2>Hello,</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2> I have setup memcached and it works great for getting / setting simple strings using the Perl API. The problem I have is when I try to SET / GET arrays ( ie: @Array ).</FONT></DIV><FONT face=Arial size=2>
<DIV> </DIV>
<DIV>Here is the code I tried, this works fine for $String but with @CachedValue it doesn't work. I assume I'm not referencing the array correctly... any ideas?</DIV>
<DIV> </DIV>
<DIV> my $memd = new Cache::Memcached {<BR> 'servers' => [ "localhost:1111" ],<BR> };</DIV>
<DIV> </DIV>
<DIV> use Digest::SHA1 qw(sha1 sha1_hex sha1_base64);<BR> my $HashKey = sha1_hex("$statement");</DIV>
<DIV> </DIV>
<DIV> # Get a value - will fail the first time as it has not been set.<BR> my @CachedValue = $memd->get( $HashKey );</DIV>
<DIV> </DIV>
<DIV> if ( @CachedValue )</DIV>
<DIV> {</DIV>
<DIV> print "Got it!";</DIV>
<DIV> exit;</DIV>
<DIV> }</DIV>
<DIV> else</DIV>
<DIV> {</DIV>
<DIV> < Get from DB ></DIV>
<DIV> </DIV>
<DIV> # Set cache</DIV>
<DIV> # Wasn't cached, so cache it!<BR> $memd->set($HashKey, @Result);<BR> $memd->disconnect_all();</DIV>
<DIV> }<BR></DIV>
<DIV>Luc </FONT></DIV></body>
</html>