CC: | mohammad.anwar [...] yahoo.com |
Subject: | Silently ignores if it can't open the connection to the memcached server |
Hi,
I have come across very annoying bug in Cache::Memcached module where it
doesn't shout when it can't reach the memcached server. User happily
thinks all is good where in reality it is not.
I have attached the test script that I used for testing. I tried calling
mehod sock_to_host() to check if we actually have any socket or not.
That does tell me whether the server is up or down.
It would have been nice if this was checked in the constructor i.e. new()
and carp() if it can't reach memcached server.
I take this opportunity to Thank you for such a lovely interface.
Best Regards,
Mohammad Sajid Anwar
London
Subject: | test-memcached-server.pl |
#!/usr/bin/perl
use strict; use warnings;
use Cache::Memcached;
my $memcached = Cache::Memcached->new({servers=>['127.0.0.1:11211'], debug => 1});
die "Unable to connect: $!\n" unless defined $memcached;
print "Connected? [Untrusted information]\n";
my $socket = $memcached->sock_to_host('127.0.0.1:11211');
print "No socket, server is actually down.\n" unless defined $socket;
print "You can be sure that server is up and running.\n";