summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Bugzilla/Memcached.pm11
1 files changed, 9 insertions, 2 deletions
diff --git a/Bugzilla/Memcached.pm b/Bugzilla/Memcached.pm
index 9868dfb42..388d8c5ed 100644
--- a/Bugzilla/Memcached.pm
+++ b/Bugzilla/Memcached.pm
@@ -16,7 +16,7 @@ use Log::Log4perl qw(:easy);
use Bugzilla::Error;
use Scalar::Util qw(blessed);
use List::Util qw(sum);
-use Bugzilla::Util qw(trick_taint);
+use Bugzilla::Util qw(trick_taint trim);
use URI::Escape;
use Encode;
use Sys::Syslog qw(:DEFAULT);
@@ -37,7 +37,7 @@ sub _new {
$self->{namespace} = Bugzilla->localconfig->{memcached_namespace};
TRACE("connecting servers: $servers, namespace: $self->{namespace}");
$self->{memcached} = Cache::Memcached::Fast->new({
- servers => [ split(/[, ]+/, $servers) ],
+ servers => [ _parse_memcached_server_list($servers) ],
namespace => $self->{namespace},
max_size => 1024 * 1024 * 4,
});
@@ -48,6 +48,13 @@ sub _new {
return bless($self, $class);
}
+sub _parse_memcached_server_list {
+ my ($server_list) = @_;
+ my @servers = split(/[, ]+/, trim($server_list));
+
+ return map { /:[0-9]+$/s ? $_ : "$_:11211" } @servers;
+}
+
sub enabled {
return $_[0]->{memcached} ? 1 : 0;
}