How to cache simple arrays

Ask Bjørn Hansen ask at develooper.com
Mon Oct 30 01:16:58 UTC 2006


On Oct 29, 2006, at 9:05 AM, Luc Levesque wrote:

[...]
>         my @CachedValue = $memd->get( $HashKey );
>
my $CachedValue = $memd->get( $HashKey );

>         if ( @CachedValue )

# if you want to test that the list of values isn't empty like in  
your example
if ( $CachedValue && @$CachedValue )

[....]
>             # Wasn't cached, so cache it!
>             $memd->set($HashKey, @Result);

          $memd->set($HashKey, \@Result);

>             $memd->disconnect_all();

Don't do that.

-- 
http://askask.com/  - http://develooper.com/




More information about the memcached mailing list