diff options
author | Dylan William Hardison <dylan@hardison.net> | 2018-03-01 21:13:01 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-01 21:13:01 +0100 |
commit | ee53f368cbdab939fbc70e82bf135967b796f5c0 (patch) | |
tree | daaf6769a7b30793b3ed6522332a6dbc039201d3 /Bugzilla | |
parent | fb85881651195cd97ef1499136e947dd56c3b4f3 (diff) | |
download | bugzilla-ee53f368cbdab939fbc70e82bf135967b796f5c0.tar.gz bugzilla-ee53f368cbdab939fbc70e82bf135967b796f5c0.tar.xz |
Bug 1442099 - Add memcached tracing to help debug weirdness in cloud env
Diffstat (limited to 'Bugzilla')
-rw-r--r-- | Bugzilla/Memcached.pm | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/Bugzilla/Memcached.pm b/Bugzilla/Memcached.pm index 1623296f8..0ceed97c0 100644 --- a/Bugzilla/Memcached.pm +++ b/Bugzilla/Memcached.pm @@ -11,6 +11,8 @@ use 5.10.1; use strict; use warnings; +use Bugzilla::Logging; +use Log::Log4perl qw(:easy); use Bugzilla::Error; use Scalar::Util qw(blessed); use List::Util qw(sum); @@ -33,12 +35,16 @@ sub _new { my $servers = Bugzilla->localconfig->{memcached_servers}; 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 => [ split(/[, ]+/, $servers) ], namespace => $self->{namespace}, max_size => 1024 * 1024 * 4, }); } + else { + TRACE("memcached feature is not enabled"); + } return bless($self, $class); } @@ -266,9 +272,7 @@ sub _inc_prefix { delete Bugzilla->request_cache->{"memcached_prefix_$name"}; # BMO - log that we've wiped the cache - openlog('apache', 'cons,pid', 'local4'); - syslog('notice', encode_utf8("[memcached] $name cache cleared")); - closelog(); + INFO("$name cache cleared"); } sub _global_prefix { @@ -300,17 +304,20 @@ sub _set { param => "value" }); } - $key = $self->_encode_key($key) + my $enc_key = $self->_encode_key($key) or return; - return $self->{memcached}->set($key, $value); + TRACE("set $enc_key"); + return $self->{memcached}->set($enc_key, $value); } sub _get { my ($self, $key) = @_; - $key = $self->_encode_key($key) + my $enc_key = $self->_encode_key($key) or return; - return $self->{memcached}->get($key); + my $val = $self->{memcached}->get($key); + TRACE("get $enc_key: " . (defined $val ? "HIT" : "MISS")); + return $val; } sub _delete { |