summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDylan Hardison <dylan@mozilla.com>2016-06-01 16:30:37 +0200
committerDylan Hardison <dylan@mozilla.com>2016-06-01 16:31:17 +0200
commita0a047d035cc340f8cf856a2ef937ece578d13d8 (patch)
tree6673c5e7fdaafb1a0e24d1881237c4065ca01478
parent7ccda0890dafcb58f5665680b8af0ceb0acf85b0 (diff)
downloadbugzilla-a0a047d035cc340f8cf856a2ef937ece578d13d8.tar.gz
bugzilla-a0a047d035cc340f8cf856a2ef937ece578d13d8.tar.xz
Bug 1274764 - Increasing memcached performance is possible because Cache::Memcached::Fast does not need detainting
r=dkl,a=dylan
-rw-r--r--Bugzilla/Memcached.pm51
1 files changed, 2 insertions, 49 deletions
diff --git a/Bugzilla/Memcached.pm b/Bugzilla/Memcached.pm
index 8a367ea25..139824679 100644
--- a/Bugzilla/Memcached.pm
+++ b/Bugzilla/Memcached.pm
@@ -12,7 +12,6 @@ use strict;
use warnings;
use Bugzilla::Error;
-use Bugzilla::Util qw(trick_taint);
use Scalar::Util qw(blessed);
use URI::Escape;
@@ -243,51 +242,7 @@ sub _get {
$key = $self->_encode_key($key)
or return;
- my $value = $self->{memcached}->get($key);
- return unless defined $value;
-
- # detaint returned values
- # hashes and arrays are detainted just one level deep
- if (ref($value) eq 'HASH') {
- _detaint_hashref($value);
- }
- elsif (ref($value) eq 'ARRAY') {
- foreach my $value (@$value) {
- next unless defined $value;
- # arrays of hashes and arrays are common
- if (ref($value) eq 'HASH') {
- _detaint_hashref($value);
- }
- elsif (ref($value) eq 'ARRAY') {
- _detaint_arrayref($value);
- }
- elsif (!ref($value)) {
- trick_taint($value);
- }
- }
- }
- elsif (!ref($value)) {
- trick_taint($value);
- }
- return $value;
-}
-
-sub _detaint_hashref {
- my ($hashref) = @_;
- foreach my $value (values %$hashref) {
- if (defined($value) && !ref($value)) {
- trick_taint($value);
- }
- }
-}
-
-sub _detaint_arrayref {
- my ($arrayref) = @_;
- foreach my $value (@$arrayref) {
- if (defined($value) && !ref($value)) {
- trick_taint($value);
- }
- }
+ return $self->{memcached}->get($key);
}
sub _delete {
@@ -340,9 +295,7 @@ L<Bugzilla::Memcached> provides an interface to a Memcached server/servers, with
the ability to get, set, or clear entries from the cache.
The stored value must be an unblessed hashref, unblessed array ref, or a
-scalar. Currently nested data structures are supported but require manual
-de-tainting after reading from Memcached (flat data structures are automatically
-de-tainted).
+scalar.
All values are stored in the Memcached systems using the prefix configured with
the C<memcached_namespace> parameter, as well as an additional prefix managed