summaryrefslogtreecommitdiff
path: root/includes/objectcache/MemcachedClient.php
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2016-05-01 15:30:02 -0400
committerLuke Shumaker <lukeshu@sbcglobal.net>2016-05-01 15:30:02 -0400
commit1de335ad3f395ca6861085393ba366a9e3fb4a0d (patch)
treef1fdd326034e05177596851be6a7127615d81498 /includes/objectcache/MemcachedClient.php
parent9c75fa8ff6d4d38ef552c00fef5969fb154765e8 (diff)
parentf6d65e533c62f6deb21342d4901ece24497b433e (diff)
Merge commit 'f6d65'
# Conflicts: # skins/ArchLinux/ArchLinux.php
Diffstat (limited to 'includes/objectcache/MemcachedClient.php')
-rw-r--r--includes/objectcache/MemcachedClient.php20
1 files changed, 12 insertions, 8 deletions
diff --git a/includes/objectcache/MemcachedClient.php b/includes/objectcache/MemcachedClient.php
index 41eebfb5..bc4a00b2 100644
--- a/includes/objectcache/MemcachedClient.php
+++ b/includes/objectcache/MemcachedClient.php
@@ -64,6 +64,9 @@
* @version 0.1.2
*/
+use Psr\Log\LoggerInterface;
+use Psr\Log\NullLogger;
+
// {{{ requirements
// }}}
@@ -233,6 +236,11 @@ class MWMemcached {
*/
public $_connect_attempts;
+ /**
+ * @var LoggerInterface
+ */
+ private $_logger;
+
// }}}
// }}}
// {{{ methods
@@ -263,6 +271,8 @@ class MWMemcached {
$this->_connect_timeout = isset( $args['connect_timeout'] ) ? $args['connect_timeout'] : 0.1;
$this->_connect_attempts = 2;
+
+ $this->_logger = isset( $args['logger'] ) ? $args['logger'] : new NullLogger();
}
// }}}
@@ -413,7 +423,6 @@ class MWMemcached {
* @return mixed
*/
public function get( $key, &$casToken = null ) {
- wfProfileIn( __METHOD__ );
if ( $this->_debug ) {
$this->_debugprint( "get($key)\n" );
@@ -421,19 +430,16 @@ class MWMemcached {
if ( !is_array( $key ) && strval( $key ) === '' ) {
$this->_debugprint( "Skipping key which equals to an empty string" );
- wfProfileOut( __METHOD__ );
return false;
}
if ( !$this->_active ) {
- wfProfileOut( __METHOD__ );
return false;
}
$sock = $this->get_sock( $key );
if ( !is_resource( $sock ) ) {
- wfProfileOut( __METHOD__ );
return false;
}
@@ -446,7 +452,6 @@ class MWMemcached {
$cmd = "gets $key\r\n";
if ( !$this->_fwrite( $sock, $cmd ) ) {
- wfProfileOut( __METHOD__ );
return false;
}
@@ -463,7 +468,6 @@ class MWMemcached {
if ( isset( $val[$key] ) ) {
$value = $val[$key];
}
- wfProfileOut( __METHOD__ );
return $value;
}
@@ -1110,14 +1114,14 @@ class MWMemcached {
* @param string $text
*/
function _debugprint( $text ) {
- wfDebugLog( 'memcached', $text );
+ $this->_logger->debug( $text );
}
/**
* @param string $text
*/
function _error_log( $text ) {
- wfDebugLog( 'memcached-serious', "Memcached error: $text" );
+ $this->_logger->error( "Memcached error: $text" );
}
/**