This question:
http://code.google.com/p/memcached/wiki/FAQ#Can_I_access_the_same_data_in_memcached_with_different_client_li
says:
"The Perl Cache::Memcached will use Storable to serialize complex structures (like hash references, objects, etc)."

I take this to mean that storing hashes in Perl is supported; however when I tried the following code to store and retrieve a hash in memcached:

>>>
#!/usr/bin/perl

use Cache::Memcached;

# Configure the memcached server

my $cache = new Cache::Memcached {
    'servers' => [
                   'localhost:11211',
                   ],
    };

my %testhash;
$testhash{'a'} = 'b';
$testhash{'c'} = 'q';

$cache->set('abc',%testhash);

my %returnedhash = $cache->get('abc');
print $returnedhash{'a'};
>>>

I get the following error:
Argument "q" isn't numeric in int at /usr/lib/perl5/vendor_perl/5.8.8/Cache/Memcached.pm line 477.

('q' appears in the line "$testhash{'c'} = 'q';". If I replace that 'q' with some other letter, then the error message complains about whatever letter I put there instead.)

So does this mean that (a) storing Perl hashes in memcached is not supported after all; (b) it is officially supported, and this is a bug, or (c) I am doing it wrong?

        -Bennett

Reply via email to