Cache::Memcached question

Joachim Bauernberger joachim.bauernberger@friendscout24.de
Mon, 3 May 2004 17:31:59 +0200


Hi,

=2E.. just had look at Memcached.pm ...

=46rom what I could see, the connections aren't made when calling=20
new Cache::Memcached
=2E.. which would explain why I didn't get the errors (silly me).

In order to get what I want I modified Memcached.pm and simply called=20
sock_to_host in set_servers() for every server:ip in @list

Think this is the correct way since the sockets are kept global in the=20
%cache_sock hash, no?

Regards,
~/joachim


On Monday 03 May 2004 12:37, Joachim Bauernberger wrote:
> Hi,
>
> How do you guys check if the connection to memcached was successful?
> No matter what I put into $config_memcachedhost below and no matter if
> memcached is running, the following would always result in a defined $memd
> object returned. Also $@ is empty.
>
> How do you trap errors in connection setup?
>
> sub init_memcached
> {
>     eval {
>         $memd =3D new Cache::Memcached {
>         'servers' =3D>  @config_memcachedhosts ,
>         'debug' =3D> $config_memcached_debug,
>         'compress_threshold' =3D> $config_compress_threshold,
>         }
>     };
>     die localtime()." Error connecting ($!) Cache::Memcached: $@\n" if ($@
>
> || !defined ($memd));
>
>     return;
> }
>
> Thanks & best regards,
>
> Is there a cvs for this too?
> Brad wanted to do something like $memd->errstr() IIRC in future releases.
>
>
> Thanks & Best regards,
> ~/joachim

=2D-=20
Web: http://www.bauernberger.org/