diff options
author | Dylan William Hardison <dylan@hardison.net> | 2018-04-01 16:46:28 +0200 |
---|---|---|
committer | Dylan William Hardison <dylan@hardison.net> | 2018-04-01 16:46:28 +0200 |
commit | 2f8b999750cc700faf03c6aee1c53d1fc4df767f (patch) | |
tree | ef00bf6fd9932fd4fa1fc69e3108a1c5603aa64a /Bugzilla/Memcached.pm | |
parent | c6d0d0e31a8b7b0e3c46ddf0a2be7741716d7977 (diff) | |
parent | 45485679f2e173170ed9c0e8a0eae979fe9de067 (diff) | |
download | bugzilla-2f8b999750cc700faf03c6aee1c53d1fc4df767f.tar.gz bugzilla-2f8b999750cc700faf03c6aee1c53d1fc4df767f.tar.xz |
Merge branch 'master' of git://github.com/mozilla-bteam/bmo
Diffstat (limited to 'Bugzilla/Memcached.pm')
-rw-r--r-- | Bugzilla/Memcached.pm | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/Bugzilla/Memcached.pm b/Bugzilla/Memcached.pm index 85e3505e1..d34aaa595 100644 --- a/Bugzilla/Memcached.pm +++ b/Bugzilla/Memcached.pm @@ -36,11 +36,25 @@ sub _new { if (Bugzilla->feature('memcached') && $servers) { $self->{namespace} = Bugzilla->localconfig->{memcached_namespace}; TRACE("connecting servers: $servers, namespace: $self->{namespace}"); - $self->{memcached} = Cache::Memcached::Fast->new({ - servers => [ _parse_memcached_server_list($servers) ], - namespace => $self->{namespace}, - max_size => 1024 * 1024 * 4, - }); + $self->{memcached} = Cache::Memcached::Fast->new( + { + servers => [ _parse_memcached_server_list($servers) ], + namespace => $self->{namespace}, + max_size => 1024 * 1024 * 4, + max_failures => 1, + failure_timeout => 60, + io_timeout => 0.2, + connect_timeout => 0.2, + } + ); + my $versions = $self->{memcached}->server_versions; + if (keys %$versions) { + # this is needed to ensure forked processes don't start out with a connected memcached socket. + $self->{memcached}->disconnect_all; + } + else { + WARN("No memcached servers"); + } } else { TRACE("memcached feature is not enabled"); @@ -324,7 +338,7 @@ sub _get { my $enc_key = $self->_encode_key($key) or return; - my $val = $self->{memcached}->get($key); + my $val = $self->{memcached}->get($enc_key); TRACE("get $enc_key: " . (defined $val ? "HIT" : "MISS")); return $val; } |