<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[47121] trunk/tests/phpunit/includes/object-cache.php: Docs: Improve DocBlocks in `phpunit/includes/object-cache.php` per the documentation standards.</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { white-space: pre-line; overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="https://core.trac.wordpress.org/changeset/47121">47121</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"https://core.trac.wordpress.org/changeset/47121","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>SergeyBiryukov</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2020-01-29 00:36:17 +0000 (Wed, 29 Jan 2020)</dd>
</dl>
<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Docs: Improve DocBlocks in `phpunit/includes/object-cache.php` per the documentation standards.
See <a href="https://core.trac.wordpress.org/ticket/48303">#48303</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunktestsphpunitincludesobjectcachephp">trunk/tests/phpunit/includes/object-cache.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunktestsphpunitincludesobjectcachephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/includes/object-cache.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/includes/object-cache.php 2020-01-29 00:35:39 UTC (rev 47120)
+++ trunk/tests/phpunit/includes/object-cache.php 2020-01-29 00:36:17 UTC (rev 47121)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -5,13 +5,13 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * If the specified key already exists, the value is not stored and the function
</span><span class="cx" style="display: block; padding: 0 10px"> * returns false.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @link http://www.php.net/manual/en/memcached.add.php
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @link https://www.php.net/manual/en/memcached.add.php
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $key The key under which to store the value.
- * @param mixed $value The value to store.
- * @param string $group The group value appended to the $key.
- * @param int $expiration The expiration time, defaults to 0.
- * @return bool Returns TRUE on success or FALSE on failure.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $key The key under which to store the value.
+ * @param mixed $value The value to store.
+ * @param string $group The group value appended to the $key.
+ * @param int $expiration The expiration time, defaults to 0.
+ * @return bool True on success, false on failure.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function wp_cache_add( $key, $value, $group = '', $expiration = 0 ) {
</span><span class="cx" style="display: block; padding: 0 10px"> global $wp_object_cache;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -26,14 +26,14 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * _cache object as part of the runtime cache. It will add it to an array for the
</span><span class="cx" style="display: block; padding: 0 10px"> * specified server_key.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @link http://www.php.net/manual/en/memcached.addbykey.php
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @link https://www.php.net/manual/en/memcached.addbykey.php
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $server_key The key identifying the server to store the value on.
- * @param string $key The key under which to store the value.
- * @param mixed $value The value to store.
- * @param string $group The group value appended to the $key.
- * @param int $expiration The expiration time, defaults to 0.
- * @return bool Returns TRUE on success or FALSE on failure.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $server_key The key identifying the server to store the value on.
+ * @param string $key The key under which to store the value.
+ * @param mixed $value The value to store.
+ * @param string $group The group value appended to the $key.
+ * @param int $expiration The expiration time, defaults to 0.
+ * @return bool True on success, false on failure.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function wp_cache_add_by_key( $server_key, $key, $value, $group = '', $expiration = 0 ) {
</span><span class="cx" style="display: block; padding: 0 10px"> global $wp_object_cache;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -41,14 +41,15 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Add a single server to the list of Memcached servers.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Adds a single server to the list of Memcached servers.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @link http://www.php.net/manual/en/memcached.addserver.php
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @link https://www.php.net/manual/en/memcached.addserver.php
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $host The hostname of the memcache server.
- * @param int $port The port on which memcache is running.
- * @param int $weight The weight of the server relative to the total weight of all the servers in the pool.
- * @return bool Returns TRUE on success or FALSE on failure.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $host The hostname of the memcache server.
+ * @param int $port The port on which memcache is running.
+ * @param int $weight The weight of the server relative to the total weight
+ * of all the servers in the pool.
+ * @return bool True on success, false on failure.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function wp_cache_add_server( $host, $port, $weight = 0 ) {
</span><span class="cx" style="display: block; padding: 0 10px"> global $wp_object_cache;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -61,10 +62,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * Each individual server in the array must include a domain and port, with an optional
</span><span class="cx" style="display: block; padding: 0 10px"> * weight value: $servers = array( array( '127.0.0.1', 11211, 0 ) );
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @link http://www.php.net/manual/en/memcached.addservers.php
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @link https://www.php.net/manual/en/memcached.addservers.php
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param array $servers Array of server to register.
- * @return bool True on success; false on failure.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param array $servers Array of server to register.
+ * @return bool True on success, false on failure.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function wp_cache_add_servers( $servers ) {
</span><span class="cx" style="display: block; padding: 0 10px"> global $wp_object_cache;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -72,21 +73,21 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Append data to an existing item.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Appends data to an existing item.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * This method should throw an error if it is used with compressed data. This
- * is an expected behavior. Memcached casts the value to be appended to the initial value to the
- * type of the initial value. Be careful as this leads to unexpected behavior at times. Due to
- * how memcached treats types, the behavior has been mimicked in the internal cache to produce
- * similar results and improve consistency. It is recommend that appends only occur with data of
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * This method should throw an error if it is used with compressed data.
+ * This is an expected behavior. Memcached casts the value to be appended to the initial value
+ * to the type of the initial value. Be careful as this leads to unexpected behavior at times.
+ * Due to how memcached treats types, the behavior has been mimicked in the internal cache to produce
+ * similar results and improve consistency. It is recommended that appends only occur with data of
</ins><span class="cx" style="display: block; padding: 0 10px"> * the same type.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @link http://www.php.net/manual/en/memcached.append.php
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @link https://www.php.net/manual/en/memcached.append.php
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $key The key under which to store the value.
- * @param mixed $value Must be string as appending mixed values is not well-defined
- * @param string $group The group value appended to the $key.
- * @return bool Returns TRUE on success or FALSE on failure.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $key The key under which to store the value.
+ * @param mixed $value Must be string as appending mixed values is not well-defined.
+ * @param string $group The group value appended to the $key.
+ * @return bool True on success, false on failure.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function wp_cache_append( $key, $value, $group = '' ) {
</span><span class="cx" style="display: block; padding: 0 10px"> global $wp_object_cache;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -94,22 +95,22 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Append data to an existing item by server key.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Appends data to an existing item by server key.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * This method should throw an error if it is used with compressed data. This
- * is an expected behavior. Memcached casts the value to be appended to the initial value to the
- * type of the initial value. Be careful as this leads to unexpected behavior at times. Due to
- * how memcached treats types, the behavior has been mimicked in the internal cache to produce
- * similar results and improve consistency. It is recommend that appends only occur with data of
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * This method should throw an error if it is used with compressed data.
+ * This is an expected behavior. Memcached casts the value to be appended to the initial value
+ * to the type of the initial value. Be careful as this leads to unexpected behavior at times.
+ * Due to how memcached treats types, the behavior has been mimicked in the internal cache to produce
+ * similar results and improve consistency. It is recommended that appends only occur with data of
</ins><span class="cx" style="display: block; padding: 0 10px"> * the same type.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @link http://www.php.net/manual/en/memcached.appendbykey.php
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @link https://www.php.net/manual/en/memcached.appendbykey.php
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $server_key The key identifying the server to store the value on.
- * @param string $key The key under which to store the value.
- * @param mixed $value Must be string as appending mixed values is not well-defined
- * @param string $group The group value appended to the $key.
- * @return bool Returns TRUE on success or FALSE on failure.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $server_key The key identifying the server to store the value on.
+ * @param string $key The key under which to store the value.
+ * @param mixed $value Must be string as appending mixed values is not well-defined.
+ * @param string $group The group value appended to the $key.
+ * @return bool True on success, false on failure.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function wp_cache_append_by_key( $server_key, $key, $value, $group = '' ) {
</span><span class="cx" style="display: block; padding: 0 10px"> global $wp_object_cache;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -119,17 +120,17 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Performs a "check and set" to store data.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * The set will be successful only if the no other request has updated the value since it was fetched by
- * this request.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * The set will be successful only if the no other request has updated the value
+ * since it was fetched by this request.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @link http://www.php.net/manual/en/memcached.cas.php
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @link https://www.php.net/manual/en/memcached.cas.php
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param float $cas_token Unique value associated with the existing item. Generated by memcached.
- * @param string $key The key under which to store the value.
- * @param mixed $value The value to store.
- * @param string $group The group value appended to the $key.
- * @param int $expiration The expiration time, defaults to 0.
- * @return bool Returns TRUE on success or FALSE on failure.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param float $cas_token Unique value associated with the existing item. Generated by memcached.
+ * @param string $key The key under which to store the value.
+ * @param mixed $value The value to store.
+ * @param string $group The group value appended to the $key.
+ * @param int $expiration The expiration time, defaults to 0.
+ * @return bool True on success, false on failure.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function wp_cache_cas( $cas_token, $key, $value, $group = '', $expiration = 0 ) {
</span><span class="cx" style="display: block; padding: 0 10px"> global $wp_object_cache;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -139,18 +140,18 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Performs a "check and set" to store data with a server key.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * The set will be successful only if the no other request has updated the value since it was fetched by
- * this request.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * The set will be successful only if the no other request has updated the value
+ * since it was fetched by this request.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @link http://www.php.net/manual/en/memcached.casbykey.php
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @link https://www.php.net/manual/en/memcached.casbykey.php
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $server_key The key identifying the server to store the value on.
- * @param float $cas_token Unique value associated with the existing item. Generated by memcached.
- * @param string $key The key under which to store the value.
- * @param mixed $value The value to store.
- * @param string $group The group value appended to the $key.
- * @param int $expiration The expiration time, defaults to 0.
- * @return bool Returns TRUE on success or FALSE on failure.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $server_key The key identifying the server to store the value on.
+ * @param float $cas_token Unique value associated with the existing item. Generated by memcached.
+ * @param string $key The key under which to store the value.
+ * @param mixed $value The value to store.
+ * @param string $group The group value appended to the $key.
+ * @param int $expiration The expiration time, defaults to 0.
+ * @return bool True on success, false on failure.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function wp_cache_cas_by_key( $cas_token, $server_key, $key, $value, $group = '', $expiration = 0 ) {
</span><span class="cx" style="display: block; padding: 0 10px"> global $wp_object_cache;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -160,14 +161,14 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Closes the cache.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * This function has ceased to do anything since WordPress 2.5. The
- * functionality was removed along with the rest of the persistent cache. This
- * does not mean that plugins can't implement this function when they need to
- * make sure that the cache is cleaned up after WordPress no longer needs it.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * This function has ceased to do anything since WordPress 2.5.
+ * The functionality was removed along with the rest of the persistent cache.
+ * This does not mean that plugins can't implement this function when they need
+ * to make sure that the cache is cleaned up after WordPress no longer needs it.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 2.0.0
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @return bool Always returns True
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @return bool Always returns true.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function wp_cache_close() {
</span><span class="cx" style="display: block; padding: 0 10px"> return true;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -174,14 +175,14 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Decrement a numeric item's value.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Decrements a numeric item's value.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @link http://www.php.net/manual/en/memcached.decrement.php
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @link https://www.php.net/manual/en/memcached.decrement.php
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $key The key under which to store the value.
- * @param int $offset The amount by which to decrement the item's value.
- * @param string $group The group value appended to the $key.
- * @return int|bool Returns item's new value on success or FALSE on failure.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $key The key under which to store the value.
+ * @param int $offset The amount by which to decrement the item's value.
+ * @param string $group The group value appended to the $key.
+ * @return int|bool Item's new value on success, false on failure.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function wp_cache_decrement( $key, $offset = 1, $group = '' ) {
</span><span class="cx" style="display: block; padding: 0 10px"> global $wp_object_cache;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -189,17 +190,17 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Decrement a numeric item's value.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Decrements a numeric item's value.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Same as wp_cache_decrement. Original WordPress caching backends use wp_cache_decr. I
- * want both spellings to work.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * This is the same as wp_cache_decrement(), but kept for backward compatibility.
+ * The original WordPress caching backends use wp_cache_decr().
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @link http://www.php.net/manual/en/memcached.decrement.php
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @link https://www.php.net/manual/en/memcached.decrement.php
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $key The key under which to store the value.
- * @param int $offset The amount by which to decrement the item's value.
- * @param string $group The group value appended to the $key.
- * @return int|bool Returns item's new value on success or FALSE on failure.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $key The key under which to store the value.
+ * @param int $offset The amount by which to decrement the item's value.
+ * @param string $group The group value appended to the $key.
+ * @return int|bool Item's new value on success, false on failure.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function wp_cache_decr( $key, $offset = 1, $group = '' ) {
</span><span class="cx" style="display: block; padding: 0 10px"> return wp_cache_decrement( $key, $offset, $group );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -206,19 +207,19 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Remove the item from the cache.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Removes the item from the cache.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Remove an item from memcached with identified by $key after $time seconds. The
- * $time parameter allows an object to be queued for deletion without immediately
- * deleting. Between the time that it is queued and the time it's deleted, add,
- * replace, and get will fail, but set will succeed.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Removes an item from memcached with identified by $key after $time seconds.
+ * The $time parameter allows an object to be queued for deletion without
+ * immediately deleting. Between the time that it is queued and the time it's deleted,
+ * add, replace, and get will fail, but set will succeed.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @link http://www.php.net/manual/en/memcached.delete.php
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @link https://www.php.net/manual/en/memcached.delete.php
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $key The key under which to store the value.
- * @param string $group The group value appended to the $key.
- * @param int $time The amount of time the server will wait to delete the item in seconds.
- * @return bool Returns TRUE on success or FALSE on failure.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $key The key under which to store the value.
+ * @param string $group The group value appended to the $key.
+ * @param int $time The amount of time the server will wait to delete the item in seconds.
+ * @return bool True on success, false on failure.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function wp_cache_delete( $key, $group = '', $time = 0 ) {
</span><span class="cx" style="display: block; padding: 0 10px"> global $wp_object_cache;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -226,20 +227,20 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Remove the item from the cache by server key.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Removes the item from the cache by server key.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Remove an item from memcached with identified by $key after $time seconds. The
- * $time parameter allows an object to be queued for deletion without immediately
- * deleting. Between the time that it is queued and the time it's deleted, add,
- * replace, and get will fail, but set will succeed.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Removes an item from memcached with identified by $key after $time seconds.
+ * The $time parameter allows an object to be queued for deletion without
+ * immediately deleting. Between the time that it is queued and the time it's deleted,
+ * add, replace, and get will fail, but set will succeed.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @link http://www.php.net/manual/en/memcached.deletebykey.php
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @link https://www.php.net/manual/en/memcached.deletebykey.php
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $server_key The key identifying the server to store the value on.
- * @param string $key The key under which to store the value.
- * @param string $group The group value appended to the $key.
- * @param int $time The amount of time the server will wait to delete the item in seconds.
- * @return bool Returns TRUE on success or FALSE on failure.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $server_key The key identifying the server to store the value on.
+ * @param string $key The key under which to store the value.
+ * @param string $group The group value appended to the $key.
+ * @param int $time The amount of time the server will wait to delete the item in seconds.
+ * @return bool True on success, false on failure.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function wp_cache_delete_by_key( $server_key, $key, $group = '', $time = 0 ) {
</span><span class="cx" style="display: block; padding: 0 10px"> global $wp_object_cache;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -247,11 +248,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Fetch the next result.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Fetches the next result.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @link http://www.php.net/manual/en/memcached.fetch.php
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @link https://www.php.net/manual/en/memcached.fetch.php
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @return array|bool Returns the next result or FALSE otherwise.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @return array|false The next result on success, false on failure.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function wp_cache_fetch() {
</span><span class="cx" style="display: block; padding: 0 10px"> global $wp_object_cache;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -259,11 +260,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Fetch all remaining results from the last request.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Fetches all remaining results from the last request.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @link http://www.php.net/manual/en/memcached.fetchall.php
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @link https://www.php.net/manual/en/memcached.fetchall.php
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @return array|bool Returns the results or FALSE on failure.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @return array|false The results on success, false on failure.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function wp_cache_fetch_all() {
</span><span class="cx" style="display: block; padding: 0 10px"> global $wp_object_cache;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -271,12 +272,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Invalidate all items in the cache.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Invalidates all items in the cache.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @link http://www.php.net/manual/en/memcached.flush.php
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @link https://www.php.net/manual/en/memcached.flush.php
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param int $delay Number of seconds to wait before invalidating the items.
- * @return bool Returns TRUE on success or FALSE on failure.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param int $delay Number of seconds to wait before invalidating the items.
+ * @return bool True on success, false on failure.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function wp_cache_flush( $delay = 0 ) {
</span><span class="cx" style="display: block; padding: 0 10px"> global $wp_object_cache;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -284,24 +285,25 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Retrieve object from cache.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Retrieves object from cache.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Gets an object from cache based on $key and $group. In order to fully support the $cache_cb and $cas_token
- * parameters, the runtime cache is ignored by this function if either of those values are set. If either of
- * those values are set, the request is made directly to the memcached server for proper handling of the
- * callback and/or token.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Gets an object from cache based on $key and $group. In order to fully support
+ * the $cache_cb and $cas_token parameters, the runtime cache is ignored by this function
+ * if either of those values are set. In that case, the request is made directly
+ * to the memcached server for proper handling of the callback and/or token.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Note that the $deprecated and $found args are only here for compatibility with the native wp_cache_get function.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Note that the $deprecated and $found args are only here for compatibility
+ * with the native wp_cache_get() function.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @link http://www.php.net/manual/en/memcached.get.php
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @link https://www.php.net/manual/en/memcached.get.php
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $key The key under which to store the value.
- * @param string $group The group value appended to the $key.
- * @param bool $force Whether or not to force a cache invalidation.
- * @param null|bool $found Variable passed by reference to determine if the value was found or not.
- * @param null|string $cache_cb Read-through caching callback.
- * @param null|float $cas_token The variable to store the CAS token in.
- * @return bool|mixed Cached object value.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $key The key under which to store the value.
+ * @param string $group The group value appended to the $key.
+ * @param bool $force Whether or not to force a cache invalidation.
+ * @param null|bool $found Variable passed by reference to determine if the value was found or not.
+ * @param null|string $cache_cb Read-through caching callback.
+ * @param null|float $cas_token The variable to store the CAS token in.
+ * @return bool|mixed Cached object value.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function wp_cache_get( $key, $group = '', $force = false, &$found = null, $cache_cb = null, &$cas_token = null ) {
</span><span class="cx" style="display: block; padding: 0 10px"> global $wp_object_cache;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -314,23 +316,23 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Retrieve object from cache from specified server.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Retrieves object from cache from specified server.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Gets an object from cache based on $key, $group and $server_key. In order to fully support the $cache_cb and $cas_token
- * parameters, the runtime cache is ignored by this function if either of those values are set. If either of
- * those values are set, the request is made directly to the memcached server for proper handling of the
- * callback and/or token.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Gets an object from cache based on $key, $group, and $server_key. In order to fully support
+ * the $cache_cb and $cas_token parameters, the runtime cache is ignored by this function
+ * if either of those values are set. In that case, the request is made directly
+ * to the memcached server for proper handling of the callback and/or token.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @link http://www.php.net/manual/en/memcached.getbykey.php
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @link https://www.php.net/manual/en/memcached.getbykey.php
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $server_key The key identifying the server to store the value on.
- * @param string $key The key under which to store the value.
- * @param string $group The group value appended to the $key.
- * @param bool $force Whether or not to force a cache invalidation.
- * @param null|bool $found Variable passed by reference to determine if the value was found or not.
- * @param null|string $cache_cb Read-through caching callback.
- * @param null|float $cas_token The variable to store the CAS token in.
- * @return bool|mixed Cached object value.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $server_key The key identifying the server to store the value on.
+ * @param string $key The key under which to store the value.
+ * @param string $group The group value appended to the $key.
+ * @param bool $force Whether or not to force a cache invalidation.
+ * @param null|bool $found Variable passed by reference to determine if the value was found or not.
+ * @param null|string $cache_cb Read-through caching callback.
+ * @param null|float $cas_token The variable to store the CAS token in.
+ * @return bool|mixed Cached object value.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function wp_cache_get_by_key( $server_key, $key, $group = '', $force = false, &$found = null, $cache_cb = null, &$cas_token = null ) {
</span><span class="cx" style="display: block; padding: 0 10px"> global $wp_object_cache;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -343,15 +345,16 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Request multiple keys without blocking.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Requests multiple keys without blocking.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @link http://www.php.net/manual/en/memcached.getdelayed.php
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @link https://www.php.net/manual/en/memcached.getdelayed.php
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string|array $keys Array or string of key(s) to request.
- * @param string|array $groups Array or string of group(s) for the key(s). See buildKeys for more on how these are handled.
- * @param bool $with_cas Whether to request CAS token values also.
- * @param null $value_cb The result callback or NULL.
- * @return bool Returns TRUE on success or FALSE on failure.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string|array $keys Array or string of key(s) to request.
+ * @param string|array $groups Array or string of group(s) for the key(s).
+ * See buildKeys for more on how these are handled.
+ * @param bool $with_cas Whether to request CAS token values also.
+ * @param null $value_cb The result callback or null.
+ * @return bool True on success, false on failure.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function wp_cache_get_delayed( $keys, $groups = '', $with_cas = false, $value_cb = null ) {
</span><span class="cx" style="display: block; padding: 0 10px"> global $wp_object_cache;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -359,16 +362,17 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Request multiple keys without blocking from a specified server.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Requests multiple keys without blocking from a specified server.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @link http://www.php.net/manual/en/memcached.getdelayed.php
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @link https://www.php.net/manual/en/memcached.getdelayed.php
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $server_key The key identifying the server to store the value on.
- * @param string|array $keys Array or string of key(s) to request.
- * @param string|array $groups Array or string of group(s) for the key(s). See buildKeys for more on how these are handled.
- * @param bool $with_cas Whether to request CAS token values also.
- * @param null $value_cb The result callback or NULL.
- * @return bool Returns TRUE on success or FALSE on failure.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $server_key The key identifying the server to store the value on.
+ * @param string|array $keys Array or string of key(s) to request.
+ * @param string|array $groups Array or string of group(s) for the key(s).
+ * See buildKeys for more on how these are handled.
+ * @param bool $with_cas Whether to request CAS token values also.
+ * @param null $value_cb The result callback or null.
+ * @return bool True on success, false on failure.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function wp_cache_get_delayed_by_key( $server_key, $keys, $groups = '', $with_cas = false, $value_cb = null ) {
</span><span class="cx" style="display: block; padding: 0 10px"> global $wp_object_cache;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -380,13 +384,14 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * See the buildKeys method definition to understand the $keys/$groups parameters.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @link http://www.php.net/manual/en/memcached.getmulti.php
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @link https://www.php.net/manual/en/memcached.getmulti.php
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param array $keys Array of keys to retrieve.
- * @param string|array $groups If string, used for all keys. If arrays, corresponds with the $keys array.
- * @param null|array $cas_tokens The variable to store the CAS tokens for the found items.
- * @param int $flags The flags for the get operation.
- * @return bool|array Returns the array of found items or FALSE on failure.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param array $keys Array of keys to retrieve.
+ * @param string|array $groups If string, used for all keys.
+ * If arrays, corresponds with the $keys array.
+ * @param null|array $cas_tokens The variable to store the CAS tokens for the found items.
+ * @param int $flags The flags for the get operation.
+ * @return bool|array The array of found items on success, false on failure.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function wp_cache_get_multi( $keys, $groups = '', &$cas_tokens = null, $flags = null ) {
</span><span class="cx" style="display: block; padding: 0 10px"> global $wp_object_cache;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -403,14 +408,15 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * See the buildKeys method definition to understand the $keys/$groups parameters.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @link http://www.php.net/manual/en/memcached.getmultibykey.php
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @link https://www.php.net/manual/en/memcached.getmultibykey.php
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $server_key The key identifying the server to store the value on.
- * @param array $keys Array of keys to retrieve.
- * @param string|array $groups If string, used for all keys. If arrays, corresponds with the $keys array.
- * @param null|array $cas_tokens The variable to store the CAS tokens for the found items.
- * @param int $flags The flags for the get operation.
- * @return bool|array Returns the array of found items or FALSE on failure.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $server_key The key identifying the server to store the value on.
+ * @param array $keys Array of keys to retrieve.
+ * @param string|array $groups If string, used for all keys.
+ * If arrays, corresponds with the $keys array.
+ * @param null|array $cas_tokens The variable to store the CAS tokens for the found items.
+ * @param int $flags The flags for the get operation.
+ * @return bool|array The array of found items on success, false on failure.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function wp_cache_get_multi_by_key( $server_key, $keys, $groups = '', &$cas_tokens = null, $flags = null ) {
</span><span class="cx" style="display: block; padding: 0 10px"> global $wp_object_cache;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -423,12 +429,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Retrieve a Memcached option value.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Retrieves a Memcached option value.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @link http://www.php.net/manual/en/memcached.getoption.php
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @link https://www.php.net/manual/en/memcached.getoption.php
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param int $option One of the Memcached::OPT_* constants.
- * @return mixed Returns the value of the requested option, or FALSE on error.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param int $option One of the Memcached::OPT_* constants.
+ * @return mixed The value of the requested option on success, false on failure.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function wp_cache_get_option( $option ) {
</span><span class="cx" style="display: block; padding: 0 10px"> global $wp_object_cache;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -436,11 +442,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Return the result code of the last option.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Returns the result code of the last option.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @link http://www.php.net/manual/en/memcached.getresultcode.php
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @link https://www.php.net/manual/en/memcached.getresultcode.php
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @return int Result code of the last Memcached operation.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @return int Result code of the last Memcached operation.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function wp_cache_get_result_code() {
</span><span class="cx" style="display: block; padding: 0 10px"> global $wp_object_cache;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -450,9 +456,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Return the message describing the result of the last operation.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @link http://www.php.net/manual/en/memcached.getresultmessage.php
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @link https://www.php.net/manual/en/memcached.getresultmessage.php
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @return string Message describing the result of the last Memcached operation.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @return string Message describing the result of the last Memcached operation.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function wp_cache_get_result_message() {
</span><span class="cx" style="display: block; padding: 0 10px"> global $wp_object_cache;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -460,12 +466,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Get server information by key.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Gets server information by key.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @link http://www.php.net/manual/en/memcached.getserverbykey.php
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @link https://www.php.net/manual/en/memcached.getserverbykey.php
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $server_key The key identifying the server to store the value on.
- * @return array Array with host, post, and weight on success, FALSE on failure.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $server_key The key identifying the server to store the value on.
+ * @return array Array with host, post, and weight on success, fales on failure.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function wp_cache_get_server_by_key( $server_key ) {
</span><span class="cx" style="display: block; padding: 0 10px"> global $wp_object_cache;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -473,11 +479,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Get the list of servers in the pool.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Gets the list of servers in the pool.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @link http://www.php.net/manual/en/memcached.getserverlist.php
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @link https://www.php.net/manual/en/memcached.getserverlist.php
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @return array The list of all servers in the server pool.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @return array The list of all servers in the server pool.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function wp_cache_get_server_list() {
</span><span class="cx" style="display: block; padding: 0 10px"> global $wp_object_cache;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -485,11 +491,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Get server pool statistics.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Gets server pool statistics.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @link http://www.php.net/manual/en/memcached.getstats.php
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @link https://www.php.net/manual/en/memcached.getstats.php
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @return array Array of server statistics, one entry per server.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @return array Array of server statistics, one entry per server.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function wp_cache_get_stats() {
</span><span class="cx" style="display: block; padding: 0 10px"> global $wp_object_cache;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -497,11 +503,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Get server pool memcached version information.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Gets server pool memcached version information.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @link http://www.php.net/manual/en/memcached.getversion.php
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @link https://www.php.net/manual/en/memcached.getversion.php
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @return array Array of server versions, one entry per server.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @return array Array of server versions, one entry per server.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function wp_cache_get_version() {
</span><span class="cx" style="display: block; padding: 0 10px"> global $wp_object_cache;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -509,14 +515,14 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Increment a numeric item's value.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Increments a numeric item's value.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @link http://www.php.net/manual/en/memcached.increment.php
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @link https://www.php.net/manual/en/memcached.increment.php
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $key The key under which to store the value.
- * @param int $offset The amount by which to increment the item's value.
- * @param string $group The group value appended to the $key.
- * @return int|bool Returns item's new value on success or FALSE on failure.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $key The key under which to store the value.
+ * @param int $offset The amount by which to increment the item's value.
+ * @param string $group The group value appended to the $key.
+ * @return int|bool Item's new value on success, false on failure.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function wp_cache_increment( $key, $offset = 1, $group = '' ) {
</span><span class="cx" style="display: block; padding: 0 10px"> global $wp_object_cache;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -524,17 +530,17 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Increment a numeric item's value.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Increments a numeric item's value.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * This is the same as wp_cache_increment, but kept for back compatibility. The original
- * WordPress caching backends use wp_cache_incr. I want both to work.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * This is the same as wp_cache_increment(), but kept for backward compatibility.
+ * The original WordPress caching backends use wp_cache_incr().
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @link http://www.php.net/manual/en/memcached.increment.php
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @link https://www.php.net/manual/en/memcached.increment.php
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $key The key under which to store the value.
- * @param int $offset The amount by which to increment the item's value.
- * @param string $group The group value appended to the $key.
- * @return int|bool Returns item's new value on success or FALSE on failure.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $key The key under which to store the value.
+ * @param int $offset The amount by which to increment the item's value.
+ * @param string $group The group value appended to the $key.
+ * @return int|bool Item's new value on success, false on failure.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function wp_cache_incr( $key, $offset = 1, $group = '' ) {
</span><span class="cx" style="display: block; padding: 0 10px"> return wp_cache_increment( $key, $offset, $group );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -541,22 +547,22 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Prepend data to an existing item.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Prepends data to an existing item.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * This method should throw an error if it is used with compressed data. This is an expected behavior.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Memcached casts the value to be prepended to the initial value to the type of the initial value. Be
- * careful as this leads to unexpected behavior at times. For instance, prepending (float) 45.23 to
- * (int) 23 will result in 45, because the value is first combined (45.2323) then cast to "integer"
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Memcached casts the value to be prepended to the initial value to the type of the initial value.
+ * Be careful as this leads to unexpected behavior at times. For instance, prepending (float) 45.23
+ * to (int) 23 will result in 45, because the value is first combined (45.2323) then cast to "integer"
</ins><span class="cx" style="display: block; padding: 0 10px"> * (the original value), which will be (int) 45. Due to how memcached treats types, the behavior has been
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * mimicked in the internal cache to produce similar results and improve consistency. It is recommend
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * mimicked in the internal cache to produce similar results and improve consistency. It is recommended
</ins><span class="cx" style="display: block; padding: 0 10px"> * that prepends only occur with data of the same type.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @link http://www.php.net/manual/en/memcached.prepend.php
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @link https://www.php.net/manual/en/memcached.prepend.php
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $key The key under which to store the value.
- * @param string $value Must be string as prepending mixed values is not well-defined.
- * @param string $group The group value prepended to the $key.
- * @return bool Returns TRUE on success or FALSE on failure.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $key The key under which to store the value.
+ * @param string $value Must be string as prepending mixed values is not well-defined.
+ * @param string $group The group value prepended to the $key.
+ * @return bool True on success, false on failure.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function wp_cache_prepend( $key, $value, $group = '' ) {
</span><span class="cx" style="display: block; padding: 0 10px"> global $wp_object_cache;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -564,23 +570,23 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Append data to an existing item by server key.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Appends data to an existing item by server key.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * This method should throw an error if it is used with compressed data. This is an expected behavior.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Memcached casts the value to be prepended to the initial value to the type of the initial value. Be
- * careful as this leads to unexpected behavior at times. For instance, prepending (float) 45.23 to
- * (int) 23 will result in 45, because the value is first combined (45.2323) then cast to "integer"
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Memcached casts the value to be prepended to the initial value to the type of the initial value.
+ * Be careful as this leads to unexpected behavior at times. For instance, prepending (float) 45.23
+ * to (int) 23 will result in 45, because the value is first combined (45.2323) then cast to "integer"
</ins><span class="cx" style="display: block; padding: 0 10px"> * (the original value), which will be (int) 45. Due to how memcached treats types, the behavior has been
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * mimicked in the internal cache to produce similar results and improve consistency. It is recommend
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * mimicked in the internal cache to produce similar results and improve consistency. It is recommended
</ins><span class="cx" style="display: block; padding: 0 10px"> * that prepends only occur with data of the same type.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @link http://www.php.net/manual/en/memcached.prependbykey.php
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @link https://www.php.net/manual/en/memcached.prependbykey.php
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $server_key The key identifying the server to store the value on.
- * @param string $key The key under which to store the value.
- * @param string $value Must be string as prepending mixed values is not well-defined.
- * @param string $group The group value prepended to the $key.
- * @return bool Returns TRUE on success or FALSE on failure.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $server_key The key identifying the server to store the value on.
+ * @param string $key The key under which to store the value.
+ * @param string $value Must be string as prepending mixed values is not well-defined.
+ * @param string $group The group value prepended to the $key.
+ * @return bool True on success, false on failure.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function wp_cache_prepend_by_key( $server_key, $key, $value, $group = '' ) {
</span><span class="cx" style="display: block; padding: 0 10px"> global $wp_object_cache;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -590,16 +596,16 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Replaces a value in cache.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * This method is similar to "add"; however, is does not successfully set a value if
- * the object's key is not already set in cache.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * This method is similar to "add"; however, is does not successfully set a value
+ * if the object's key is not already set in cache.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @link http://www.php.net/manual/en/memcached.replace.php
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @link https://www.php.net/manual/en/memcached.replace.php
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $key The key under which to store the value.
- * @param mixed $value The value to store.
- * @param string $group The group value appended to the $key.
- * @param int $expiration The expiration time, defaults to 0.
- * @return bool Returns TRUE on success or FALSE on failure.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $key The key under which to store the value.
+ * @param mixed $value The value to store.
+ * @param string $group The group value appended to the $key.
+ * @param int $expiration The expiration time, defaults to 0.
+ * @return bool True on success, false on failure.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function wp_cache_replace( $key, $value, $group = '', $expiration = 0 ) {
</span><span class="cx" style="display: block; padding: 0 10px"> global $wp_object_cache;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -609,17 +615,17 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Replaces a value in cache on a specific server.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * This method is similar to "addByKey"; however, is does not successfully set a value if
- * the object's key is not already set in cache.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * This method is similar to "addByKey"; however, is does not successfully set a value
+ * if the object's key is not already set in cache.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @link http://www.php.net/manual/en/memcached.addbykey.php
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @link https://www.php.net/manual/en/memcached.addbykey.php
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $server_key The key identifying the server to store the value on.
- * @param string $key The key under which to store the value.
- * @param mixed $value The value to store.
- * @param string $group The group value appended to the $key.
- * @param int $expiration The expiration time, defaults to 0.
- * @return bool Returns TRUE on success or FALSE on failure.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $server_key The key identifying the server to store the value on.
+ * @param string $key The key under which to store the value.
+ * @param mixed $value The value to store.
+ * @param string $group The group value appended to the $key.
+ * @param int $expiration The expiration time, defaults to 0.
+ * @return bool True on success, false on failure.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function wp_cache_replace_by_key( $server_key, $key, $value, $group = '', $expiration = 0 ) {
</span><span class="cx" style="display: block; padding: 0 10px"> global $wp_object_cache;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -631,13 +637,13 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * The value is set whether or not this key already exists in memcached.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @link http://www.php.net/manual/en/memcached.set.php
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @link https://www.php.net/manual/en/memcached.set.php
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $key The key under which to store the value.
- * @param mixed $value The value to store.
- * @param string $group The group value appended to the $key.
- * @param int $expiration The expiration time, defaults to 0.
- * @return bool Returns TRUE on success or FALSE on failure.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $key The key under which to store the value.
+ * @param mixed $value The value to store.
+ * @param string $group The group value appended to the $key.
+ * @param int $expiration The expiration time, defaults to 0.
+ * @return bool True on success, false on failure.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function wp_cache_set( $key, $value, $group = '', $expiration = 0 ) {
</span><span class="cx" style="display: block; padding: 0 10px"> global $wp_object_cache;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -649,14 +655,14 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * The value is set whether or not this key already exists in memcached.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @link http://www.php.net/manual/en/memcached.set.php
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @link https://www.php.net/manual/en/memcached.set.php
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $server_key The key identifying the server to store the value on.
- * @param string $key The key under which to store the value.
- * @param mixed $value The value to store.
- * @param string $group The group value appended to the $key.
- * @param int $expiration The expiration time, defaults to 0.
- * @return bool Returns TRUE on success or FALSE on failure.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $server_key The key identifying the server to store the value on.
+ * @param string $key The key under which to store the value.
+ * @param mixed $value The value to store.
+ * @param string $group The group value appended to the $key.
+ * @param int $expiration The expiration time, defaults to 0.
+ * @return bool True on success, false on failure.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function wp_cache_set_by_key( $server_key, $key, $value, $group = '', $expiration = 0 ) {
</span><span class="cx" style="display: block; padding: 0 10px"> global $wp_object_cache;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -664,7 +670,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Set multiple values to cache at once.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Sets multiple values to cache at once.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * By sending an array of $items to this function, all values are saved at once to
</span><span class="cx" style="display: block; padding: 0 10px"> * memcached, reducing the need for multiple requests to memcached. The $items array
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -672,10 +678,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * are merged with the $groups array/string value via buildKeys to determine the
</span><span class="cx" style="display: block; padding: 0 10px"> * final key for the object.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param array $items An array of key/value pairs to store on the server.
- * @param string|array $groups Group(s) to merge with key(s) in $items.
- * @param int $expiration The expiration time, defaults to 0.
- * @return bool Returns TRUE on success or FALSE on failure.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param array $items An array of key/value pairs to store on the server.
+ * @param string|array $groups Group(s) to merge with key(s) in $items.
+ * @param int $expiration The expiration time, defaults to 0.
+ * @return bool True on success, false on failure.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function wp_cache_set_multi( $items, $groups = '', $expiration = 0 ) {
</span><span class="cx" style="display: block; padding: 0 10px"> global $wp_object_cache;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -683,7 +689,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Set multiple values to cache at once on specified server.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Sets multiple values to cache at once on specified server.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * By sending an array of $items to this function, all values are saved at once to
</span><span class="cx" style="display: block; padding: 0 10px"> * memcached, reducing the need for multiple requests to memcached. The $items array
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -691,11 +697,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * are merged with the $groups array/string value via buildKeys to determine the
</span><span class="cx" style="display: block; padding: 0 10px"> * final key for the object.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $server_key The key identifying the server to store the value on.
- * @param array $items An array of key/value pairs to store on the server.
- * @param string|array $groups Group(s) to merge with key(s) in $items.
- * @param int $expiration The expiration time, defaults to 0.
- * @return bool Returns TRUE on success or FALSE on failure.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $server_key The key identifying the server to store the value on.
+ * @param array $items An array of key/value pairs to store on the server.
+ * @param string|array $groups Group(s) to merge with key(s) in $items.
+ * @param int $expiration The expiration time, defaults to 0.
+ * @return bool True on success, false on failure.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function wp_cache_set_multi_by_key( $server_key, $items, $groups = 'default', $expiration = 0 ) {
</span><span class="cx" style="display: block; padding: 0 10px"> global $wp_object_cache;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -703,13 +709,13 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Set a Memcached option.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Sets a Memcached option.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @link http://www.php.net/manual/en/memcached.setoption.php
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @link https://www.php.net/manual/en/memcached.setoption.php
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param int $option Option name.
- * @param mixed $value Option value.
- * @return bool Returns TRUE on success or FALSE on failure.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param int $option Option name.
+ * @param mixed $value Option value.
+ * @return bool True on success, false on failure.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function wp_cache_set_option( $option, $value ) {
</span><span class="cx" style="display: block; padding: 0 10px"> global $wp_object_cache;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -717,9 +723,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Switch blog prefix, which changes the cache that is accessed.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Switches blog prefix, which changes the cache that is accessed.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param int $blog_id Blog to switch to.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param int $blog_id Blog to switch to.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @return void
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function wp_cache_switch_to_blog( $blog_id ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -731,8 +737,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Sets up Object Cache Global and assigns it.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @global WP_Object_Cache $wp_object_cache WordPress Object Cache
- * @return void
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @global WP_Object_Cache $wp_object_cache WordPress Object Cache
+ * @return void
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function wp_cache_init() {
</span><span class="cx" style="display: block; padding: 0 10px"> global $wp_object_cache;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -742,8 +748,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Adds a group or set of groups to the list of non-persistent groups.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string|array $groups A group or an array of groups to add.
- * @return void
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string|array $groups A group or an array of groups to add.
+ * @return void
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function wp_cache_add_global_groups( $groups ) {
</span><span class="cx" style="display: block; padding: 0 10px"> global $wp_object_cache;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -753,8 +759,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Adds a group or set of groups to the list of non-Memcached groups.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string|array $groups A group or an array of groups to add.
- * @return void
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string|array $groups A group or an array of groups to add.
+ * @return void
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function wp_cache_add_non_persistent_groups( $groups ) {
</span><span class="cx" style="display: block; padding: 0 10px"> global $wp_object_cache;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -814,14 +820,15 @@
</span><span class="cx" style="display: block; padding: 0 10px"> public $blog_prefix = '';
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Instantiate the Memcached class.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Instantiates the Memcached class.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * Instantiates the Memcached class and returns adds the servers specified
</span><span class="cx" style="display: block; padding: 0 10px"> * in the $memcached_servers global array.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @link http://www.php.net/manual/en/memcached.construct.php
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @link https://www.php.net/manual/en/memcached.construct.php
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param null $persistent_id To create an instance that persists between requests, use persistent_id to specify a unique ID for the instance.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param null $persistent_id To create an instance that persists between requests,
+ * use persistent_id to specify a unique ID for the instance.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function __construct( $persistent_id = null ) {
</span><span class="cx" style="display: block; padding: 0 10px"> global $memcached_servers, $blog_id, $table_prefix;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -841,20 +848,20 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $this->addServers( $this->servers );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * This approach is borrowed from Sivel and Boren. Use the salt for easy cache invalidation and for
- * multi single WP installations on the same server.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * This approach is borrowed from Sivel and Boren. Use the salt for easy cache invalidation
+ * and for multi single WP installations on the same server.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! defined( 'WP_CACHE_KEY_SALT' ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> define( 'WP_CACHE_KEY_SALT', '' );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Assign global and blog prefixes for use with keys
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Assign global and blog prefixes for use with keys.
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( function_exists( 'is_multisite' ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $this->global_prefix = ( is_multisite() || defined( 'CUSTOM_USER_TABLE' ) && defined( 'CUSTOM_USER_META_TABLE' ) ) ? '' : $table_prefix;
</span><span class="cx" style="display: block; padding: 0 10px"> $this->blog_prefix = ( is_multisite() ? $blog_id : $table_prefix ) . ':';
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Setup cacheable values for handling expiration times
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Setup cacheable values for handling expiration times.
</ins><span class="cx" style="display: block; padding: 0 10px"> $this->thirty_days = 60 * 60 * 24 * 30;
</span><span class="cx" style="display: block; padding: 0 10px"> $this->now = time();
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -865,15 +872,15 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * If the specified key already exists, the value is not stored and the function
</span><span class="cx" style="display: block; padding: 0 10px"> * returns false.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @link http://www.php.net/manual/en/memcached.add.php
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @link https://www.php.net/manual/en/memcached.add.php
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $key The key under which to store the value.
- * @param mixed $value The value to store.
- * @param string $group The group value appended to the $key.
- * @param int $expiration The expiration time, defaults to 0.
- * @param string $server_key The key identifying the server to store the value on.
- * @param bool $by_key True to store in internal cache by key; false to not store by key
- * @return bool Returns TRUE on success or FALSE on failure.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $key The key under which to store the value.
+ * @param mixed $value The value to store.
+ * @param string $group The group value appended to the $key.
+ * @param int $expiration The expiration time, defaults to 0.
+ * @param string $server_key The key identifying the server to store the value on.
+ * @param bool $by_key True to store in internal cache by key; false to not store by key.
+ * @return bool True on success, false on failure.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function add( $key, $value, $group = 'default', $expiration = 0, $server_key = '', $by_key = false ) {
</span><span class="cx" style="display: block; padding: 0 10px"> /*
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -889,10 +896,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $derived_key = $this->buildKey( $key, $group );
</span><span class="cx" style="display: block; padding: 0 10px"> $expiration = $this->sanitize_expiration( $expiration );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // If group is a non-Memcached group, save to runtime cache, not Memcached
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // If group is a non-Memcached group, save to runtime cache, not Memcached.
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( in_array( $group, $this->no_mc_groups, true ) ) {
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Add does not set the value if the key exists; mimic that here
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Add does not set the value if the key exists; mimic that here.
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( isset( $this->cache[ $derived_key ] ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> return false;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -902,7 +909,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> return true;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Save to Memcached
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Save to Memcached.
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( $by_key ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $result = $this->m->addByKey( $server_key, $derived_key, $value, $expiration );
</span><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -909,7 +916,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $result = $this->m->add( $derived_key, $value, $expiration );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Store in runtime cache if add was successful
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Store in runtime cache if add was successful.
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( Memcached::RES_SUCCESS === $this->getResultCode() ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $this->add_to_internal_cache( $derived_key, $value );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -925,14 +932,14 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * _cache object as part of the runtime cache. It will add it to an array for the
</span><span class="cx" style="display: block; padding: 0 10px"> * specified server_key.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @link http://www.php.net/manual/en/memcached.addbykey.php
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @link https://www.php.net/manual/en/memcached.addbykey.php
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $server_key The key identifying the server to store the value on.
- * @param string $key The key under which to store the value.
- * @param mixed $value The value to store.
- * @param string $group The group value appended to the $key.
- * @param int $expiration The expiration time, defaults to 0.
- * @return bool Returns TRUE on success or FALSE on failure.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $server_key The key identifying the server to store the value on.
+ * @param string $key The key under which to store the value.
+ * @param mixed $value The value to store.
+ * @param string $group The group value appended to the $key.
+ * @param int $expiration The expiration time, defaults to 0.
+ * @return bool True on success, false on failure.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function addByKey( $server_key, $key, $value, $group = 'default', $expiration = 0 ) {
</span><span class="cx" style="display: block; padding: 0 10px"> return $this->add( $key, $value, $group, $expiration, $server_key, true );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -939,14 +946,15 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Add a single server to the list of Memcached servers.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Adds a single server to the list of Memcached servers.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @link http://www.php.net/manual/en/memcached.addserver.php
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @link https://www.php.net/manual/en/memcached.addserver.php
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $host The hostname of the memcache server.
- * @param int $port The port on which memcache is running.
- * @param int $weight The weight of the server relative to the total weight of all the servers in the pool.
- * @return bool Returns TRUE on success or FALSE on failure.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $host The hostname of the memcache server.
+ * @param int $port The port on which memcache is running.
+ * @param int $weight The weight of the server relative to the total weight
+ * of all the servers in the pool.
+ * @return bool True on success, false on failure.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function addServer( $host, $port, $weight = 0 ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $host = is_string( $host ) ? $host : '127.0.0.1';
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -962,10 +970,10 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * Each individual server in the array must include a domain and port, with an optional
</span><span class="cx" style="display: block; padding: 0 10px"> * weight value: $servers = array( array( '127.0.0.1', 11211, 0 ) );
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @link http://www.php.net/manual/en/memcached.addservers.php
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @link https://www.php.net/manual/en/memcached.addservers.php
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param array $servers Array of server to register.
- * @return bool True on success; false on failure.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param array $servers Array of server to register.
+ * @return bool True on success, false on failure.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function addServers( $servers ) {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! is_object( $this->m ) ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -976,23 +984,23 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Append data to an existing item.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Appends data to an existing item.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * This method should throw an error if it is used with compressed data. This
- * is an expected behavior. Memcached casts the value to be appended to the initial value to the
- * type of the initial value. Be careful as this leads to unexpected behavior at times. Due to
- * how memcached treats types, the behavior has been mimicked in the internal cache to produce
- * similar results and improve consistency. It is recommend that appends only occur with data of
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * This method should throw an error if it is used with compressed data.
+ * This is an expected behavior. Memcached casts the value to be appended to the initial value
+ * to the type of the initial value. Be careful as this leads to unexpected behavior at times.
+ * Due to how memcached treats types, the behavior has been mimicked in the internal cache to produce
+ * similar results and improve consistency. It is recommended that appends only occur with data of
</ins><span class="cx" style="display: block; padding: 0 10px"> * the same type.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @link http://www.php.net/manual/en/memcached.append.php
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @link https://www.php.net/manual/en/memcached.append.php
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $key The key under which to store the value.
- * @param mixed $value Must be string as appending mixed values is not well-defined.
- * @param string $group The group value appended to the $key.
- * @param string $server_key The key identifying the server to store the value on.
- * @param bool $by_key True to store in internal cache by key; false to not store by key
- * @return bool Returns TRUE on success or FALSE on failure.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $key The key under which to store the value.
+ * @param mixed $value Must be string as appending mixed values is not well-defined.
+ * @param string $group The group value appended to the $key.
+ * @param string $server_key The key identifying the server to store the value on.
+ * @param bool $by_key True to store in internal cache by key; false to not store by key.
+ * @return bool True on success, false on failure.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function append( $key, $value, $group = 'default', $server_key = '', $by_key = false ) {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! is_string( $value ) && ! is_int( $value ) && ! is_float( $value ) ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1001,7 +1009,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $derived_key = $this->buildKey( $key, $group );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // If group is a non-Memcached group, append to runtime cache value, not Memcached
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // If group is a non-Memcached group, append to runtime cache value, not Memcached.
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( in_array( $group, $this->no_mc_groups, true ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! isset( $this->cache[ $derived_key ] ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> return false;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1012,7 +1020,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> return true;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Append to Memcached value
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Append to Memcached value.
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( $by_key ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $result = $this->m->appendByKey( $server_key, $derived_key, $value );
</span><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1019,7 +1027,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $result = $this->m->append( $derived_key, $value );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Store in runtime cache if add was successful
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Store in runtime cache if add was successful.
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( Memcached::RES_SUCCESS === $this->getResultCode() ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $combined = $this->combine_values( $this->cache[ $derived_key ], $value, 'app' );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->add_to_internal_cache( $derived_key, $combined );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1029,22 +1037,22 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Append data to an existing item by server key.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Appends data to an existing item by server key.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * This method should throw an error if it is used with compressed data. This
- * is an expected behavior. Memcached casts the value to be appended to the initial value to the
- * type of the initial value. Be careful as this leads to unexpected behavior at times. Due to
- * how memcached treats types, the behavior has been mimicked in the internal cache to produce
- * similar results and improve consistency. It is recommend that appends only occur with data of
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * This method should throw an error if it is used with compressed data.
+ * This is an expected behavior. Memcached casts the value to be appended to the initial value
+ * to the type of the initial value. Be careful as this leads to unexpected behavior at times.
+ * Due to how memcached treats types, the behavior has been mimicked in the internal cache to produce
+ * similar results and improve consistency. It is recommended that appends only occur with data of
</ins><span class="cx" style="display: block; padding: 0 10px"> * the same type.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @link http://www.php.net/manual/en/memcached.appendbykey.php
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @link https://www.php.net/manual/en/memcached.appendbykey.php
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $server_key The key identifying the server to store the value on.
- * @param string $key The key under which to store the value.
- * @param mixed $value Must be string as appending mixed values is not well-defined
- * @param string $group The group value appended to the $key.
- * @return bool Returns TRUE on success or FALSE on failure.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $server_key The key identifying the server to store the value on.
+ * @param string $key The key under which to store the value.
+ * @param mixed $value Must be string as appending mixed values is not well-defined.
+ * @param string $group The group value appended to the $key.
+ * @return bool True on success, false on failure.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function appendByKey( $server_key, $key, $value, $group = 'default' ) {
</span><span class="cx" style="display: block; padding: 0 10px"> return $this->append( $key, $value, $group, $server_key, true );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1053,19 +1061,19 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Performs a "check and set" to store data.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * The set will be successful only if the no other request has updated the value since it was fetched since
- * this request.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * The set will be successful only if the no other request has updated the value
+ * since it was fetched by this request.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @link http://www.php.net/manual/en/memcached.cas.php
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @link https://www.php.net/manual/en/memcached.cas.php
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param float $cas_token Unique value associated with the existing item. Generated by memcached.
- * @param string $key The key under which to store the value.
- * @param mixed $value The value to store.
- * @param string $group The group value appended to the $key.
- * @param int $expiration The expiration time, defaults to 0.
- * @param string $server_key The key identifying the server to store the value on.
- * @param bool $by_key True to store in internal cache by key; false to not store by key
- * @return bool Returns TRUE on success or FALSE on failure.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param float $cas_token Unique value associated with the existing item. Generated by memcached.
+ * @param string $key The key under which to store the value.
+ * @param mixed $value The value to store.
+ * @param string $group The group value appended to the $key.
+ * @param int $expiration The expiration time, defaults to 0.
+ * @param string $server_key The key identifying the server to store the value on.
+ * @param bool $by_key True to store in internal cache by key; false to not store by key.
+ * @return bool True on success, false on failure.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function cas( $cas_token, $key, $value, $group = 'default', $expiration = 0, $server_key = '', $by_key = false ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $derived_key = $this->buildKey( $key, $group );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1081,7 +1089,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> return true;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Save to Memcached
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Save to Memcached.
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( $by_key ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $result = $this->m->casByKey( $cas_token, $server_key, $derived_key, $value, $expiration );
</span><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1088,7 +1096,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $result = $this->m->cas( $cas_token, $derived_key, $value, $expiration );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Store in runtime cache if cas was successful
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Store in runtime cache if cas was successful.
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( Memcached::RES_SUCCESS === $this->getResultCode() ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $this->add_to_internal_cache( $derived_key, $value );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1099,18 +1107,18 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Performs a "check and set" to store data with a server key.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * The set will be successful only if the no other request has updated the value since it was fetched by
- * this request.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * The set will be successful only if the no other request has updated the value
+ * since it was fetched by this request.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @link http://www.php.net/manual/en/memcached.casbykey.php
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @link https://www.php.net/manual/en/memcached.casbykey.php
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $server_key The key identifying the server to store the value on.
- * @param float $cas_token Unique value associated with the existing item. Generated by memcached.
- * @param string $key The key under which to store the value.
- * @param mixed $value The value to store.
- * @param string $group The group value appended to the $key.
- * @param int $expiration The expiration time, defaults to 0.
- * @return bool Returns TRUE on success or FALSE on failure.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $server_key The key identifying the server to store the value on.
+ * @param float $cas_token Unique value associated with the existing item. Generated by memcached.
+ * @param string $key The key under which to store the value.
+ * @param mixed $value The value to store.
+ * @param string $group The group value appended to the $key.
+ * @param int $expiration The expiration time, defaults to 0.
+ * @return bool True on success, false on failure.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function casByKey( $cas_token, $server_key, $key, $value, $group = 'default', $expiration = 0 ) {
</span><span class="cx" style="display: block; padding: 0 10px"> return $this->cas( $cas_token, $key, $value, $group, $expiration, $server_key, true );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1117,25 +1125,25 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Decrement a numeric item's value.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Decrements a numeric item's value.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @link http://www.php.net/manual/en/memcached.decrement.php
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @link https://www.php.net/manual/en/memcached.decrement.php
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $key The key under which to store the value.
- * @param int $offset The amount by which to decrement the item's value.
- * @param string $group The group value appended to the $key.
- * @return int|bool Returns item's new value on success or FALSE on failure.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $key The key under which to store the value.
+ * @param int $offset The amount by which to decrement the item's value.
+ * @param string $group The group value appended to the $key.
+ * @return int|bool Item's new value on success, false on failure.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function decrement( $key, $offset = 1, $group = 'default' ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $derived_key = $this->buildKey( $key, $group );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Decrement values in no_mc_groups
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Decrement values in no_mc_groups.
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( in_array( $group, $this->no_mc_groups, true ) ) {
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Only decrement if the key already exists and value is 0 or greater (mimics memcached behavior)
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Only decrement if the key already exists and value is 0 or greater (mimics memcached behavior).
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( isset( $this->cache[ $derived_key ] ) && $this->cache[ $derived_key ] >= 0 ) {
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // If numeric, subtract; otherwise, consider it 0 and do nothing
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // If numeric, subtract; otherwise, consider it 0 and do nothing.
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( is_numeric( $this->cache[ $derived_key ] ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $this->cache[ $derived_key ] -= (int) $offset;
</span><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1142,7 +1150,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $this->cache[ $derived_key ] = 0;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Returned value cannot be less than 0
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Returned value cannot be less than 0.
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( $this->cache[ $derived_key ] < 0 ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $this->cache[ $derived_key ] = 0;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1163,15 +1171,16 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Decrement a numeric item's value.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Decrements a numeric item's value.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Alias for $this->decrement. Other caching backends use this abbreviated form of the function. It *may* cause
- * breakage somewhere, so it is nice to have. This function will also allow the core unit tests to pass.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Alias for $this->decrement(). Other caching backends use this abbreviated form
+ * of the function. It *may* cause breakage somewhere, so it is nice to have.
+ * This function will also allow the core unit tests to pass.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $key The key under which to store the value.
- * @param int $offset The amount by which to decrement the item's value.
- * @param string $group The group value appended to the $key.
- * @return int|bool Returns item's new value on success or FALSE on failure.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $key The key under which to store the value.
+ * @param int $offset The amount by which to decrement the item's value.
+ * @param string $group The group value appended to the $key.
+ * @return int|bool Item's new value on success, false on failure.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function decr( $key, $offset = 1, $group = 'default' ) {
</span><span class="cx" style="display: block; padding: 0 10px"> return $this->decrement( $key, $offset, $group );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1178,26 +1187,26 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Remove the item from the cache.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Removes the item from the cache.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Remove an item from memcached with identified by $key after $time seconds. The
- * $time parameter allows an object to be queued for deletion without immediately
- * deleting. Between the time that it is queued and the time it's deleted, add,
- * replace, and get will fail, but set will succeed.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Removes an item from memcached with identified by $key after $time seconds.
+ * The $time parameter allows an object to be queued for deletion without
+ * immediately deleting. Between the time that it is queued and the time it's deleted,
+ * add, replace, and get will fail, but set will succeed.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @link http://www.php.net/manual/en/memcached.delete.php
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @link https://www.php.net/manual/en/memcached.delete.php
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $key The key under which to store the value.
- * @param string $group The group value appended to the $key.
- * @param int $time The amount of time the server will wait to delete the item in seconds.
- * @param string $server_key The key identifying the server to store the value on.
- * @param bool $by_key True to store in internal cache by key; false to not store by key
- * @return bool Returns TRUE on success or FALSE on failure.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $key The key under which to store the value.
+ * @param string $group The group value appended to the $key.
+ * @param int $time The amount of time the server will wait to delete the item in seconds.
+ * @param string $server_key The key identifying the server to store the value on.
+ * @param bool $by_key True to store in internal cache by key; false to not store by key.
+ * @return bool True on success, false on failure.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function delete( $key, $group = 'default', $time = 0, $server_key = '', $by_key = false ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $derived_key = $this->buildKey( $key, $group );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Remove from no_mc_groups array
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Remove from no_mc_groups array.
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( in_array( $group, $this->no_mc_groups, true ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( isset( $this->cache[ $derived_key ] ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> unset( $this->cache[ $derived_key ] );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1220,20 +1229,20 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Remove the item from the cache by server key.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Removes the item from the cache by server key.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Remove an item from memcached with identified by $key after $time seconds. The
- * $time parameter allows an object to be queued for deletion without immediately
- * deleting. Between the time that it is queued and the time it's deleted, add,
- * replace, and get will fail, but set will succeed.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Removes an item from memcached with identified by $key after $time seconds.
+ * The $time parameter allows an object to be queued for deletion without
+ * immediately deleting. Between the time that it is queued and the time it's deleted,
+ * add, replace, and get will fail, but set will succeed.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @link http://www.php.net/manual/en/memcached.deletebykey.php
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @link https://www.php.net/manual/en/memcached.deletebykey.php
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $server_key The key identifying the server to store the value on.
- * @param string $key The key under which to store the value.
- * @param string $group The group value appended to the $key.
- * @param int $time The amount of time the server will wait to delete the item in seconds.
- * @return bool Returns TRUE on success or FALSE on failure.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $server_key The key identifying the server to store the value on.
+ * @param string $key The key under which to store the value.
+ * @param string $group The group value appended to the $key.
+ * @param int $time The amount of time the server will wait to delete the item in seconds.
+ * @return bool True on success, false on failure.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function deleteByKey( $server_key, $key, $group = 'default', $time = 0 ) {
</span><span class="cx" style="display: block; padding: 0 10px"> return $this->delete( $key, $group, $time, $server_key, true );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1240,11 +1249,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Fetch the next result.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Fetches the next result.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @link http://www.php.net/manual/en/memcached.fetch.php
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @link https://www.php.net/manual/en/memcached.fetch.php
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @return array|bool Returns the next result or FALSE on failure.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @return array|false The next result on success, false on failure.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function fetch() {
</span><span class="cx" style="display: block; padding: 0 10px"> return $this->m->fetch();
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1251,11 +1260,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Fetch all remaining results from the last request.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Fetches all remaining results from the last request.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @link http://www.php.net/manual/en/memcached.fetchall.php
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @link https://www.php.net/manual/en/memcached.fetchall.php
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @return array|bool Returns the results or FALSE on failure.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @return array|false The results on success, false on failure.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function fetchAll() {
</span><span class="cx" style="display: block; padding: 0 10px"> return $this->m->fetchAll();
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1262,17 +1271,17 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Invalidate all items in the cache.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Invalidates all items in the cache.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @link http://www.php.net/manual/en/memcached.flush.php
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @link https://www.php.net/manual/en/memcached.flush.php
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param int $delay Number of seconds to wait before invalidating the items.
- * @return bool Returns TRUE on success or FALSE on failure.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param int $delay Number of seconds to wait before invalidating the items.
+ * @return bool True on success, false on failure.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function flush( $delay = 0 ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $result = $this->m->flush( $delay );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Only reset the runtime cache if memcached was properly flushed
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Only reset the runtime cache if memcached was properly flushed.
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( Memcached::RES_SUCCESS === $this->getResultCode() ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $this->cache = array();
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1281,36 +1290,37 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Retrieve object from cache.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Retrieves object from cache.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Gets an object from cache based on $key and $group. In order to fully support the $cache_cb and $cas_token
- * parameters, the runtime cache is ignored by this function if either of those values are set. If either of
- * those values are set, the request is made directly to the memcached server for proper handling of the
- * callback and/or token. Note that the $cas_token variable cannot be directly passed to the function. The
- * variable need to be first defined with a non null value.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Gets an object from cache based on $key and $group. In order to fully support
+ * the $cache_cb and $cas_token parameters, the runtime cache is ignored by this function
+ * if either of those values are set. In that case, the request is made directly
+ * to the memcached server for proper handling of the callback and/or token.
+ * Note that the $cas_token variable cannot be directly passed to the function.
+ * The variable needs to be first defined with a non-null value.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * If using the $cache_cb argument, the new value will always have an expiration of time of 0 (forever). This
- * is a limitation of the Memcached PECL extension.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * If using the $cache_cb argument, the new value will always have an expiration
+ * of time of 0 (forever). This is a limitation of the Memcached PECL extension.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @link http://www.php.net/manual/en/memcached.get.php
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @link https://www.php.net/manual/en/memcached.get.php
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $key The key under which to store the value.
- * @param string $group The group value appended to the $key.
- * @param bool $force Whether or not to force a cache invalidation.
- * @param null|bool $found Variable passed by reference to determine if the value was found or not.
- * @param string $server_key The key identifying the server to store the value on.
- * @param bool $by_key True to store in internal cache by key; false to not store by key
- * @param null|callable $cache_cb Read-through caching callback.
- * @param null|float $cas_token The variable to store the CAS token in.
- * @return bool|mixed Cached object value.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $key The key under which to store the value.
+ * @param string $group The group value appended to the $key.
+ * @param bool $force Whether or not to force a cache invalidation.
+ * @param null|bool $found Variable passed by reference to determine if the value was found or not.
+ * @param string $server_key The key identifying the server to store the value on.
+ * @param bool $by_key True to store in internal cache by key; false to not store by key.
+ * @param null|callable $cache_cb Read-through caching callback.
+ * @param null|float $cas_token The variable to store the CAS token in.
+ * @return bool|mixed Cached object value.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function get( $key, $group = 'default', $force = false, &$found = null, $server_key = '', $by_key = false, $cache_cb = null, &$cas_token = null ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $derived_key = $this->buildKey( $key, $group );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Assume object is not found
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Assume object is not found.
</ins><span class="cx" style="display: block; padding: 0 10px"> $found = false;
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // If either $cache_db, or $cas_token is set, must hit Memcached and bypass runtime cache
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // If either $cache_db, or $cas_token is set, must hit Memcached and bypass runtime cache.
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( func_num_args() > 6 && ! in_array( $group, $this->no_mc_groups, true ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( $by_key ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $value = $this->m->getByKey( $server_key, $derived_key, $cache_cb, $cas_token );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1341,27 +1351,28 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Retrieve object from cache from specified server.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Retrieves object from cache from specified server.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Gets an object from cache based on $key, $group and $server_key. In order to fully support the $cache_cb and $cas_token
- * parameters, the runtime cache is ignored by this function if either of those values are set. If either of
- * those values are set, the request is made directly to the memcached server for proper handling of the
- * callback and/or token. Note that the $cas_token variable cannot be directly passed to the function. The
- * variable need to be first defined with a non null value.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Gets an object from cache based on $key and $group, and $server_key. In order to fully support
+ * the $cache_cb and $cas_token parameters, the runtime cache is ignored by this function
+ * if either of those values are set. In that case, the request is made directly
+ * to the memcached server for proper handling of the callback and/or token.
+ * Note that the $cas_token variable cannot be directly passed to the function.
+ * The variable needs to be first defined with a non-null value.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * If using the $cache_cb argument, the new value will always have an expiration of time of 0 (forever). This
- * is a limitation of the Memcached PECL extension.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * If using the $cache_cb argument, the new value will always have an expiration
+ * of time of 0 (forever). This is a limitation of the Memcached PECL extension.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @link http://www.php.net/manual/en/memcached.getbykey.php
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @link https://www.php.net/manual/en/memcached.getbykey.php
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $server_key The key identifying the server to store the value on.
- * @param string $key The key under which to store the value.
- * @param string $group The group value appended to the $key.
- * @param bool $force Whether or not to force a cache invalidation.
- * @param null|bool $found Variable passed by reference to determine if the value was found or not.
- * @param null|string $cache_cb Read-through caching callback.
- * @param null|float $cas_token The variable to store the CAS token in.
- * @return bool|mixed Cached object value.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $server_key The key identifying the server to store the value on.
+ * @param string $key The key under which to store the value.
+ * @param string $group The group value appended to the $key.
+ * @param bool $force Whether or not to force a cache invalidation.
+ * @param null|bool $found Variable passed by reference to determine if the value was found or not.
+ * @param null|string $cache_cb Read-through caching callback.
+ * @param null|float $cas_token The variable to store the CAS token in.
+ * @return bool|mixed Cached object value.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function getByKey( $server_key, $key, $group = 'default', $force = false, &$found = null, $cache_cb = null, &$cas_token = null ) {
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1376,15 +1387,16 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Request multiple keys without blocking.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Requests multiple keys without blocking.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @link http://www.php.net/manual/en/memcached.getdelayed.php
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @link https://www.php.net/manual/en/memcached.getdelayed.php
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string|array $keys Array or string of key(s) to request.
- * @param string|array $groups Array or string of group(s) for the key(s). See buildKeys for more on how these are handled.
- * @param bool $with_cas Whether to request CAS token values also.
- * @param null $value_cb The result callback or NULL.
- * @return bool Returns TRUE on success or FALSE on failure.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string|array $keys Array or string of key(s) to request.
+ * @param string|array $groups Array or string of group(s) for the key(s).
+ * See buildKeys for more on how these are handled.
+ * @param bool $with_cas Whether to request CAS token values also.
+ * @param null $value_cb The result callback or null.
+ * @return bool True on success, false on failure.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function getDelayed( $keys, $groups = 'default', $with_cas = false, $value_cb = null ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $derived_keys = $this->buildKeys( $keys, $groups );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1392,16 +1404,17 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Request multiple keys without blocking from a specified server.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Requests multiple keys without blocking from a specified server.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @link http://www.php.net/manual/en/memcached.getdelayed.php
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @link https://www.php.net/manual/en/memcached.getdelayed.php
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $server_key The key identifying the server to store the value on.
- * @param string|array $keys Array or string of key(s) to request.
- * @param string|array $groups Array or string of group(s) for the key(s). See buildKeys for more on how these are handled.
- * @param bool $with_cas Whether to request CAS token values also.
- * @param null $value_cb The result callback or NULL.
- * @return bool Returns TRUE on success or FALSE on failure.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $server_key The key identifying the server to store the value on.
+ * @param string|array $keys Array or string of key(s) to request.
+ * @param string|array $groups Array or string of group(s) for the key(s).
+ * See buildKeys for more on how these are handled.
+ * @param bool $with_cas Whether to request CAS token values also.
+ * @param null $value_cb The result callback or null.
+ * @return bool True on success, false on failure.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function getDelayedByKey( $server_key, $keys, $groups = 'default', $with_cas = false, $value_cb = null ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $derived_keys = $this->buildKeys( $keys, $groups );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1413,22 +1426,23 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * See the buildKeys method definition to understand the $keys/$groups parameters.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @link http://www.php.net/manual/en/memcached.getmulti.php
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @link https://www.php.net/manual/en/memcached.getmulti.php
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param array $keys Array of keys to retrieve.
- * @param string|array $groups If string, used for all keys. If arrays, corresponds with the $keys array.
- * @param string $server_key The key identifying the server to store the value on.
- * @param null|array $cas_tokens The variable to store the CAS tokens for the found items.
- * @param int $flags The flags for the get operation.
- * @return bool|array Returns the array of found items or FALSE on failure.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param array $keys Array of keys to retrieve.
+ * @param string|array $groups If string, used for all keys.
+ * If arrays, corresponds with the $keys array.
+ * @param string $server_key The key identifying the server to store the value on.
+ * @param null|array $cas_tokens The variable to store the CAS tokens for the found items.
+ * @param int $flags The flags for the get operation.
+ * @return bool|array The array of found items on success, false on failure.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function getMulti( $keys, $groups = 'default', $server_key = '', &$cas_tokens = null, $flags = null ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $derived_keys = $this->buildKeys( $keys, $groups );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * If either $cas_tokens, or $flags is set, must hit Memcached and bypass runtime cache. Note that
- * this will purposely ignore no_mc_groups values as they cannot handle CAS tokens or the special
- * flags; however, if the groups of groups contains a no_mc_group, this is bypassed.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * If either $cas_tokens, or $flags is set, must hit Memcached and bypass runtime cache.
+ * Note that this will purposely ignore no_mc_groups values as they cannot handle CAS tokens
+ * or the special flags; however, if the groups of groups contains a no_mc_group, this is bypassed.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> if ( func_num_args() > 3 && ! $this->contains_no_mc_group( $groups ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! empty( $server_key ) ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1440,7 +1454,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $values = array();
</span><span class="cx" style="display: block; padding: 0 10px"> $need_to_get = array();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Pull out values from runtime cache, or mark for retrieval
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Pull out values from runtime cache, or mark for retrieval.
</ins><span class="cx" style="display: block; padding: 0 10px"> foreach ( $derived_keys as $key ) {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( isset( $this->cache[ $key ] ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $values[ $key ] = $this->cache[ $key ];
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1449,7 +1463,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Get those keys not found in the runtime cache
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Get those keys not found in the runtime cache.
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( ! empty( $need_to_get ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! empty( $server_key ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $result = $this->m->getMultiByKey( $server_key, array_keys( $need_to_get ) );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1458,12 +1472,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Merge with values found in runtime cache
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Merge with values found in runtime cache.
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( isset( $result ) && Memcached::RES_SUCCESS === $this->getResultCode() ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $values = array_merge( $values, $result );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // If order should be preserved, reorder now
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // If order should be preserved, reorder now.
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( ! empty( $need_to_get ) && Memcached::GET_PRESERVE_ORDER === $flags ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $ordered_values = array();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1478,7 +1492,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Add the values to the runtime cache
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Add the values to the runtime cache.
</ins><span class="cx" style="display: block; padding: 0 10px"> $this->cache = array_merge( $this->cache, $values );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> return $values;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1489,14 +1503,15 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * See the buildKeys method definition to understand the $keys/$groups parameters.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @link http://www.php.net/manual/en/memcached.getmultibykey.php
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @link https://www.php.net/manual/en/memcached.getmultibykey.php
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $server_key The key identifying the server to store the value on.
- * @param array $keys Array of keys to retrieve.
- * @param string|array $groups If string, used for all keys. If arrays, corresponds with the $keys array.
- * @param null|array $cas_tokens The variable to store the CAS tokens for the found items.
- * @param int $flags The flags for the get operation.
- * @return bool|array Returns the array of found items or FALSE on failure.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $server_key The key identifying the server to store the value on.
+ * @param array $keys Array of keys to retrieve.
+ * @param string|array $groups If string, used for all keys.
+ * If arrays, corresponds with the $keys array.
+ * @param null|array $cas_tokens The variable to store the CAS tokens for the found items.
+ * @param int $flags The flags for the get operation.
+ * @return bool|array The array of found items on success, false on failure.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function getMultiByKey( $server_key, $keys, $groups = 'default', &$cas_tokens = null, $flags = null ) {
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1511,12 +1526,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Retrieve a Memcached option value.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Retrieves a Memcached option value.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @link http://www.php.net/manual/en/memcached.getoption.php
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @link https://www.php.net/manual/en/memcached.getoption.php
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param int $option One of the Memcached::OPT_* constants.
- * @return mixed Returns the value of the requested option, or FALSE on error.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param int $option One of the Memcached::OPT_* constants.
+ * @return mixed The value of the requested option on success, false on failure.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function getOption( $option ) {
</span><span class="cx" style="display: block; padding: 0 10px"> return $this->m->getOption( $option );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1523,11 +1538,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Return the result code of the last option.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Returns the result code of the last option.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @link http://www.php.net/manual/en/memcached.getresultcode.php
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @link https://www.php.net/manual/en/memcached.getresultcode.php
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @return int Result code of the last Memcached operation.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @return int Result code of the last Memcached operation.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function getResultCode() {
</span><span class="cx" style="display: block; padding: 0 10px"> return $this->m->getResultCode();
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1536,9 +1551,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Return the message describing the result of the last operation.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @link http://www.php.net/manual/en/memcached.getresultmessage.php
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @link https://www.php.net/manual/en/memcached.getresultmessage.php
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @return string Message describing the result of the last Memcached operation.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @return string Message describing the result of the last Memcached operation.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function getResultMessage() {
</span><span class="cx" style="display: block; padding: 0 10px"> return $this->m->getResultMessage();
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1545,12 +1560,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Get server information by key.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Gets server information by key.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @link http://www.php.net/manual/en/memcached.getserverbykey.php
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @link https://www.php.net/manual/en/memcached.getserverbykey.php
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $server_key The key identifying the server to store the value on.
- * @return array Array with host, post, and weight on success, FALSE on failure.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $server_key The key identifying the server to store the value on.
+ * @return array Array with host, post, and weight on success, false on failure.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function getServerByKey( $server_key ) {
</span><span class="cx" style="display: block; padding: 0 10px"> return $this->m->getServerByKey( $server_key );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1557,11 +1572,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Get the list of servers in the pool.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Gets the list of servers in the pool.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @link http://www.php.net/manual/en/memcached.getserverlist.php
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @link https://www.php.net/manual/en/memcached.getserverlist.php
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @return array The list of all servers in the server pool.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @return array The list of all servers in the server pool.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function getServerList() {
</span><span class="cx" style="display: block; padding: 0 10px"> return $this->m->getServerList();
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1568,11 +1583,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Get server pool statistics.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Gets server pool statistics.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @link http://www.php.net/manual/en/memcached.getstats.php
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @link https://www.php.net/manual/en/memcached.getstats.php
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @return array Array of server statistics, one entry per server.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @return array Array of server statistics, one entry per server.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function getStats() {
</span><span class="cx" style="display: block; padding: 0 10px"> return $this->m->getStats();
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1579,11 +1594,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Get server pool memcached version information.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Gets server pool memcached version information.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @link http://www.php.net/manual/en/memcached.getversion.php
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @link https://www.php.net/manual/en/memcached.getversion.php
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @return array Array of server versions, one entry per server.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @return array Array of server versions, one entry per server.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function getVersion() {
</span><span class="cx" style="display: block; padding: 0 10px"> return $this->m->getVersion();
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1590,25 +1605,25 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Increment a numeric item's value.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Increments a numeric item's value.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @link http://www.php.net/manual/en/memcached.increment.php
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @link https://www.php.net/manual/en/memcached.increment.php
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $key The key under which to store the value.
- * @param int $offset The amount by which to increment the item's value.
- * @param string $group The group value appended to the $key.
- * @return int|bool Returns item's new value on success or FALSE on failure.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $key The key under which to store the value.
+ * @param int $offset The amount by which to increment the item's value.
+ * @param string $group The group value appended to the $key.
+ * @return int|bool Item's new value on success, false on failure.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function increment( $key, $offset = 1, $group = 'default' ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $derived_key = $this->buildKey( $key, $group );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Increment values in no_mc_groups
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Increment values in no_mc_groups.
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( in_array( $group, $this->no_mc_groups, true ) ) {
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Only increment if the key already exists and the number is currently 0 or greater (mimics memcached behavior)
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Only increment if the key already exists and the number is currently 0 or greater (mimics memcached behavior).
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( isset( $this->cache[ $derived_key ] ) && $this->cache[ $derived_key ] >= 0 ) {
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // If numeric, add; otherwise, consider it 0 and do nothing
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // If numeric, add; otherwise, consider it 0 and do nothing.
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( is_numeric( $this->cache[ $derived_key ] ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $this->cache[ $derived_key ] += (int) $offset;
</span><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1615,7 +1630,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $this->cache[ $derived_key ] = 0;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Returned value cannot be less than 0
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Returned value cannot be less than 0.
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( $this->cache[ $derived_key ] < 0 ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $this->cache[ $derived_key ] = 0;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1636,16 +1651,17 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Synonymous with $this->incr.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Alias for $this->incr().
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Certain plugins expect an "incr" method on the $wp_object_cache object (e.g., Batcache). Since the original
- * version of this library matched names to the memcached methods, the "incr" method was missing. Adding this
- * method restores compatibility with plugins expecting an "incr" method.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Certain plugins expect an "incr" method on the $wp_object_cache object (e.g., Batcache).
+ * Since the original version of this library matched names to the memcached methods,
+ * the "incr" method was missing. Adding this method restores compatibility with plugins
+ * expecting an "incr" method.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $key The key under which to store the value.
- * @param int $offset The amount by which to increment the item's value.
- * @param string $group The group value appended to the $key.
- * @return int|bool Returns item's new value on success or FALSE on failure.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $key The key under which to store the value.
+ * @param int $offset The amount by which to increment the item's value.
+ * @param string $group The group value appended to the $key.
+ * @return int|bool Item's new value on success, false on failure.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function incr( $key, $offset = 1, $group = 'default' ) {
</span><span class="cx" style="display: block; padding: 0 10px"> return $this->increment( $key, $offset, $group );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1652,24 +1668,24 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Prepend data to an existing item.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Prepends data to an existing item.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * This method should throw an error if it is used with compressed data. This is an expected behavior.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Memcached casts the value to be prepended to the initial value to the type of the initial value. Be
- * careful as this leads to unexpected behavior at times. For instance, prepending (float) 45.23 to
- * (int) 23 will result in 45, because the value is first combined (45.2323) then cast to "integer"
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Memcached casts the value to be prepended to the initial value to the type of the initial value.
+ * Be careful as this leads to unexpected behavior at times. For instance, prepending (float) 45.23
+ * to (int) 23 will result in 45, because the value is first combined (45.2323) then cast to "integer"
</ins><span class="cx" style="display: block; padding: 0 10px"> * (the original value), which will be (int) 45. Due to how memcached treats types, the behavior has been
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * mimicked in the internal cache to produce similar results and improve consistency. It is recommend
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * mimicked in the internal cache to produce similar results and improve consistency. It is recommended
</ins><span class="cx" style="display: block; padding: 0 10px"> * that prepends only occur with data of the same type.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @link http://www.php.net/manual/en/memcached.prepend.php
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @link https://www.php.net/manual/en/memcached.prepend.php
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $key The key under which to store the value.
- * @param string $value Must be string as prepending mixed values is not well-defined.
- * @param string $group The group value prepended to the $key.
- * @param string $server_key The key identifying the server to store the value on.
- * @param bool $by_key True to store in internal cache by key; false to not store by key
- * @return bool Returns TRUE on success or FALSE on failure.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $key The key under which to store the value.
+ * @param string $value Must be string as prepending mixed values is not well-defined.
+ * @param string $group The group value prepended to the $key.
+ * @param string $server_key The key identifying the server to store the value on.
+ * @param bool $by_key True to store in internal cache by key; false to not store by key.
+ * @return bool True on success, false on failure.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function prepend( $key, $value, $group = 'default', $server_key = '', $by_key = false ) {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! is_string( $value ) && ! is_int( $value ) && ! is_float( $value ) ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1678,7 +1694,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $derived_key = $this->buildKey( $key, $group );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // If group is a non-Memcached group, prepend to runtime cache value, not Memcached
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // If group is a non-Memcached group, prepend to runtime cache value, not Memcached.
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( in_array( $group, $this->no_mc_groups, true ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! isset( $this->cache[ $derived_key ] ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> return false;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1689,7 +1705,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> return true;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Append to Memcached value
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Append to Memcached value.
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( $by_key ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $result = $this->m->prependByKey( $server_key, $derived_key, $value );
</span><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1696,7 +1712,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $result = $this->m->prepend( $derived_key, $value );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Store in runtime cache if add was successful
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Store in runtime cache if add was successful.
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( Memcached::RES_SUCCESS === $this->getResultCode() ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $combined = $this->combine_values( $this->cache[ $derived_key ], $value, 'pre' );
</span><span class="cx" style="display: block; padding: 0 10px"> $this->add_to_internal_cache( $derived_key, $combined );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1706,23 +1722,23 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Append data to an existing item by server key.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Appends data to an existing item by server key.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * This method should throw an error if it is used with compressed data. This is an expected behavior.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Memcached casts the value to be prepended to the initial value to the type of the initial value. Be
- * careful as this leads to unexpected behavior at times. For instance, prepending (float) 45.23 to
- * (int) 23 will result in 45, because the value is first combined (45.2323) then cast to "integer"
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Memcached casts the value to be prepended to the initial value to the type of the initial value.
+ * Be careful as this leads to unexpected behavior at times. For instance, prepending (float) 45.23
+ * to (int) 23 will result in 45, because the value is first combined (45.2323) then cast to "integer"
</ins><span class="cx" style="display: block; padding: 0 10px"> * (the original value), which will be (int) 45. Due to how memcached treats types, the behavior has been
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * mimicked in the internal cache to produce similar results and improve consistency. It is recommend
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * mimicked in the internal cache to produce similar results and improve consistency. It is recommended
</ins><span class="cx" style="display: block; padding: 0 10px"> * that prepends only occur with data of the same type.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @link http://www.php.net/manual/en/memcached.prependbykey.php
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @link https://www.php.net/manual/en/memcached.prependbykey.php
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $server_key The key identifying the server to store the value on.
- * @param string $key The key under which to store the value.
- * @param string $value Must be string as prepending mixed values is not well-defined.
- * @param string $group The group value prepended to the $key.
- * @return bool Returns TRUE on success or FALSE on failure.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $server_key The key identifying the server to store the value on.
+ * @param string $key The key under which to store the value.
+ * @param string $value Must be string as prepending mixed values is not well-defined.
+ * @param string $group The group value prepended to the $key.
+ * @return bool True on success, false on failure.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function prependByKey( $server_key, $key, $value, $group = 'default' ) {
</span><span class="cx" style="display: block; padding: 0 10px"> return $this->prepend( $key, $value, $group, $server_key, true );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1731,27 +1747,27 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Replaces a value in cache.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * This method is similar to "add"; however, is does not successfully set a value if
- * the object's key is not already set in cache.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * This method is similar to "add"; however, is does not successfully set a value
+ * if the object's key is not already set in cache.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @link http://www.php.net/manual/en/memcached.replace.php
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @link https://www.php.net/manual/en/memcached.replace.php
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $server_key The key identifying the server to store the value on.
- * @param string $key The key under which to store the value.
- * @param mixed $value The value to store.
- * @param string $group The group value appended to the $key.
- * @param bool $by_key True to store in internal cache by key; false to not store by key
- * @param int $expiration The expiration time, defaults to 0.
- * @return bool Returns TRUE on success or FALSE on failure.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $server_key The key identifying the server to store the value on.
+ * @param string $key The key under which to store the value.
+ * @param mixed $value The value to store.
+ * @param string $group The group value appended to the $key.
+ * @param bool $by_key True to store in internal cache by key; false to not store by key.
+ * @param int $expiration The expiration time, defaults to 0.
+ * @return bool True on success, false on failure.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function replace( $key, $value, $group = 'default', $expiration = 0, $server_key = '', $by_key = false ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $derived_key = $this->buildKey( $key, $group );
</span><span class="cx" style="display: block; padding: 0 10px"> $expiration = $this->sanitize_expiration( $expiration );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // If group is a non-Memcached group, save to runtime cache, not Memcached
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // If group is a non-Memcached group, save to runtime cache, not Memcached.
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( in_array( $group, $this->no_mc_groups, true ) ) {
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Replace won't save unless the key already exists; mimic this behavior here
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Replace won't save unless the key already exists; mimic this behavior here.
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( ! isset( $this->cache[ $derived_key ] ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> return false;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1760,7 +1776,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> return true;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Save to Memcached
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Save to Memcached.
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( $by_key ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $result = $this->m->replaceByKey( $server_key, $derived_key, $value, $expiration );
</span><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1767,7 +1783,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $result = $this->m->replace( $derived_key, $value, $expiration );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Store in runtime cache if add was successful
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Store in runtime cache if add was successful.
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( Memcached::RES_SUCCESS === $this->getResultCode() ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $this->add_to_internal_cache( $derived_key, $value );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1778,17 +1794,17 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Replaces a value in cache on a specific server.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * This method is similar to "addByKey"; however, is does not successfully set a value if
- * the object's key is not already set in cache.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * This method is similar to "addByKey"; however, is does not successfully set a value
+ * if the object's key is not already set in cache.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @link http://www.php.net/manual/en/memcached.addbykey.php
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @link https://www.php.net/manual/en/memcached.addbykey.php
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $server_key The key identifying the server to store the value on.
- * @param string $key The key under which to store the value.
- * @param mixed $value The value to store.
- * @param string $group The group value appended to the $key.
- * @param int $expiration The expiration time, defaults to 0.
- * @return bool Returns TRUE on success or FALSE on failure.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $server_key The key identifying the server to store the value on.
+ * @param string $key The key under which to store the value.
+ * @param mixed $value The value to store.
+ * @param string $group The group value appended to the $key.
+ * @param int $expiration The expiration time, defaults to 0.
+ * @return bool True on success, false on failure.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function replaceByKey( $server_key, $key, $value, $group = 'default', $expiration = 0 ) {
</span><span class="cx" style="display: block; padding: 0 10px"> return $this->replace( $key, $value, $group, $expiration, $server_key, true );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1799,27 +1815,27 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * The value is set whether or not this key already exists in memcached.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @link http://www.php.net/manual/en/memcached.set.php
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @link https://www.php.net/manual/en/memcached.set.php
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $key The key under which to store the value.
- * @param mixed $value The value to store.
- * @param string $group The group value appended to the $key.
- * @param int $expiration The expiration time, defaults to 0.
- * @param string $server_key The key identifying the server to store the value on.
- * @param bool $by_key True to store in internal cache by key; false to not store by key
- * @return bool Returns TRUE on success or FALSE on failure.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $key The key under which to store the value.
+ * @param mixed $value The value to store.
+ * @param string $group The group value appended to the $key.
+ * @param int $expiration The expiration time, defaults to 0.
+ * @param string $server_key The key identifying the server to store the value on.
+ * @param bool $by_key True to store in internal cache by key; false to not store by key.
+ * @return bool True on success, false on failure.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function set( $key, $value, $group = 'default', $expiration = 0, $server_key = '', $by_key = false ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $derived_key = $this->buildKey( $key, $group );
</span><span class="cx" style="display: block; padding: 0 10px"> $expiration = $this->sanitize_expiration( $expiration );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // If group is a non-Memcached group, save to runtime cache, not Memcached
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // If group is a non-Memcached group, save to runtime cache, not Memcached.
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( in_array( $group, $this->no_mc_groups, true ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $this->add_to_internal_cache( $derived_key, $value );
</span><span class="cx" style="display: block; padding: 0 10px"> return true;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Save to Memcached
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Save to Memcached.
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( $by_key ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $result = $this->m->setByKey( $server_key, $derived_key, $value, $expiration );
</span><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1826,7 +1842,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $result = $this->m->set( $derived_key, $value, $expiration );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Store in runtime cache if add was successful
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Store in runtime cache if add was successful.
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( Memcached::RES_SUCCESS === $this->getResultCode() ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $this->add_to_internal_cache( $derived_key, $value );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1839,14 +1855,14 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * The value is set whether or not this key already exists in memcached.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @link http://www.php.net/manual/en/memcached.setbykey.php
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @link https://www.php.net/manual/en/memcached.setbykey.php
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $server_key The key identifying the server to store the value on.
- * @param string $key The key under which to store the value.
- * @param mixed $value The value to store.
- * @param string $group The group value appended to the $key.
- * @param int $expiration The expiration time, defaults to 0.
- * @return bool Returns TRUE on success or FALSE on failure.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $server_key The key identifying the server to store the value on.
+ * @param string $key The key under which to store the value.
+ * @param mixed $value The value to store.
+ * @param string $group The group value appended to the $key.
+ * @param int $expiration The expiration time, defaults to 0.
+ * @return bool True on success, false on failure.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function setByKey( $server_key, $key, $value, $group = 'default', $expiration = 0 ) {
</span><span class="cx" style="display: block; padding: 0 10px"> return $this->set( $key, $value, $group, $expiration, $server_key, true );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1853,7 +1869,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Set multiple values to cache at once.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Sets multiple values to cache at once.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * By sending an array of $items to this function, all values are saved at once to
</span><span class="cx" style="display: block; padding: 0 10px"> * memcached, reducing the need for multiple requests to memcached. The $items array
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1861,28 +1877,28 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * are merged with the $groups array/string value via buildKeys to determine the
</span><span class="cx" style="display: block; padding: 0 10px"> * final key for the object.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @link http://www.php.net/manual/en/memcached.setmulti.php
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @link https://www.php.net/manual/en/memcached.setmulti.php
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param array $items An array of key/value pairs to store on the server.
- * @param string|array $groups Group(s) to merge with key(s) in $items.
- * @param int $expiration The expiration time, defaults to 0.
- * @param string $server_key The key identifying the server to store the value on.
- * @param bool $by_key True to store in internal cache by key; false to not store by key
- * @return bool Returns TRUE on success or FALSE on failure.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param array $items An array of key/value pairs to store on the server.
+ * @param string|array $groups Group(s) to merge with key(s) in $items.
+ * @param int $expiration The expiration time, defaults to 0.
+ * @param string $server_key The key identifying the server to store the value on.
+ * @param bool $by_key True to store in internal cache by key; false to not store by key.
+ * @return bool True on success, false on failure.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function setMulti( $items, $groups = 'default', $expiration = 0, $server_key = '', $by_key = false ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Build final keys and replace $items keys with the new keys
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Build final keys and replace $items keys with the new keys.
</ins><span class="cx" style="display: block; padding: 0 10px"> $derived_keys = $this->buildKeys( array_keys( $items ), $groups );
</span><span class="cx" style="display: block; padding: 0 10px"> $expiration = $this->sanitize_expiration( $expiration );
</span><span class="cx" style="display: block; padding: 0 10px"> $derived_items = array_combine( $derived_keys, $items );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Do not add to memcached if in no_mc_groups
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Do not add to memcached if in no_mc_groups.
</ins><span class="cx" style="display: block; padding: 0 10px"> foreach ( $derived_items as $derived_key => $value ) {
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Get the individual item's group
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Get the individual item's group.
</ins><span class="cx" style="display: block; padding: 0 10px"> $key_pieces = explode( ':', $derived_key );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // If group is a non-Memcached group, save to runtime cache, not Memcached
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // If group is a non-Memcached group, save to runtime cache, not Memcached.
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( in_array( $key_pieces[1], $this->no_mc_groups, true ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $this->add_to_internal_cache( $derived_key, $value );
</span><span class="cx" style="display: block; padding: 0 10px"> unset( $derived_items[ $derived_key ] );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1889,7 +1905,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Save to memcached
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Save to memcached.
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( $by_key ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $result = $this->m->setMultiByKey( $server_key, $derived_items, $expiration );
</span><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1896,7 +1912,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $result = $this->m->setMulti( $derived_items, $expiration );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Store in runtime cache if add was successful
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Store in runtime cache if add was successful.
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( Memcached::RES_SUCCESS === $this->getResultCode() ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $this->cache = array_merge( $this->cache, $derived_items );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1905,7 +1921,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Set multiple values to cache at once on specified server.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Sets multiple values to cache at once on specified server.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * By sending an array of $items to this function, all values are saved at once to
</span><span class="cx" style="display: block; padding: 0 10px"> * memcached, reducing the need for multiple requests to memcached. The $items array
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1913,13 +1929,13 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * are merged with the $groups array/string value via buildKeys to determine the
</span><span class="cx" style="display: block; padding: 0 10px"> * final key for the object.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @link http://www.php.net/manual/en/memcached.setmultibykey.php
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @link https://www.php.net/manual/en/memcached.setmultibykey.php
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $server_key The key identifying the server to store the value on.
- * @param array $items An array of key/value pairs to store on the server.
- * @param string|array $groups Group(s) to merge with key(s) in $items.
- * @param int $expiration The expiration time, defaults to 0.
- * @return bool Returns TRUE on success or FALSE on failure.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $server_key The key identifying the server to store the value on.
+ * @param array $items An array of key/value pairs to store on the server.
+ * @param string|array $groups Group(s) to merge with key(s) in $items.
+ * @param int $expiration The expiration time, defaults to 0.
+ * @return bool True on success, false on failure.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function setMultiByKey( $server_key, $items, $groups = 'default', $expiration = 0 ) {
</span><span class="cx" style="display: block; padding: 0 10px"> return $this->setMulti( $items, $groups, $expiration, $server_key, true );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1926,13 +1942,13 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Set a Memcached option.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Sets a Memcached option.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @link http://www.php.net/manual/en/memcached.setoption.php
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @link https://www.php.net/manual/en/memcached.setoption.php
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param int $option Option name.
- * @param mixed $value Option value.
- * @return bool Returns TRUE on success or FALSE on failure.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param int $option Option name.
+ * @param mixed $value Option value.
+ * @return bool True on success, false on failure.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function setOption( $option, $value ) {
</span><span class="cx" style="display: block; padding: 0 10px"> return $this->m->setOption( $option, $value );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1941,12 +1957,14 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Builds a key for the cached object using the blog_id, key, and group values.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @author Ryan Boren This function is inspired by the original WP Memcached Object cache.
- * @link http://wordpress.org/extend/plugins/memcached/
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * This function is inspired by the original WP Memcached Object cache.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $key The key under which to store the value.
- * @param string $group The group value appended to the $key.
- * @return string
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @author Ryan Boren
+ * @link http://wordpress.org/extend/plugins/memcached/
+ *
+ * @param string $key The key under which to store the value.
+ * @param string $group The group value appended to the $key.
+ * @return string
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function buildKey( $key, $group = 'default' ) {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( empty( $group ) ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1974,14 +1992,14 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * than $keys, the method will return an empty array. This method is primarily a helper method for methods
</span><span class="cx" style="display: block; padding: 0 10px"> * that call memcached with an array of keys.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string|array $keys Key(s) to merge with group(s).
- * @param string|array $groups Group(s) to merge with key(s).
- * @return array Array that combines keys and groups into a single set of memcached keys.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string|array $keys Key(s) to merge with group(s).
+ * @param string|array $groups Group(s) to merge with key(s).
+ * @return array Array that combines keys and groups into a single set of memcached keys.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function buildKeys( $keys, $groups = 'default' ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $derived_keys = array();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // If strings sent, convert to arrays for proper handling
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // If strings sent, convert to arrays for proper handling.
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( ! is_array( $groups ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $groups = (array) $groups;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1990,13 +2008,14 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $keys = (array) $keys;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // If we have equal numbers of keys and groups, merge $keys[n] and $group[n]
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // If we have equal numbers of keys and groups, merge $keys[n] and $group[n].
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( count( $keys ) === count( $groups ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> for ( $i = 0; $i < count( $keys ); $i++ ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $derived_keys[] = $this->buildKey( $keys[ $i ], $groups[ $i ] );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // If more keys are received than groups, merge $keys[n] and $group[n] until no more group are left; remaining groups are 'default'
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // If more keys are received than groups, merge $keys[n] and $group[n]
+ // until no more groups are left; remaining groups are 'default'.
</ins><span class="cx" style="display: block; padding: 0 10px"> } elseif ( count( $keys ) > count( $groups ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> for ( $i = 0; $i < count( $keys ); $i++ ) {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( isset( $groups[ $i ] ) ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2013,14 +2032,14 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Ensure that a proper expiration time is set.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Ensures that a proper expiration time is set.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Memcached treats any value over 30 days as a timestamp. If a developer sets the expiration for greater than 30
- * days or less than the current timestamp, the timestamp is in the past and the value isn't cached. This function
- * detects values in that range and corrects them.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Memcached treats any value over 30 days as a timestamp. If a developer sets the expiration
+ * for greater than 30 days or less than the current timestamp, the timestamp is in the past
+ * and the value isn't cached. This function detects values in that range and corrects them.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string|int $expiration The dirty expiration time.
- * @return string|int The sanitized expiration time.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string|int $expiration The dirty expiration time.
+ * @return string|int The sanitized expiration time.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function sanitize_expiration( $expiration ) {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( $expiration > $this->thirty_days && $expiration <= $this->now ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2037,15 +2056,15 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * by memcached. In both cases, whichever value is the original value in the combined value
</span><span class="cx" style="display: block; padding: 0 10px"> * will dictate the type of the combined value.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param mixed $original Original value that dictates the combined type.
- * @param mixed $pended Value to combine with original value.
- * @param string $direction Either 'pre' or 'app'.
- * @return mixed Combined value casted to the type of the first value.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param mixed $original Original value that dictates the combined type.
+ * @param mixed $pended Value to combine with original value.
+ * @param string $direction Either 'pre' or 'app'.
+ * @return mixed Combined value casted to the type of the first value.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function combine_values( $original, $pended, $direction ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $type = gettype( $original );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Combine the values based on direction of the "pend"
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Combine the values based on direction of the "pend".
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( 'pre' === $direction ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $combined = $pended . $original;
</span><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2052,7 +2071,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $combined = $original . $pended;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Cast type of combined value
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Cast type of combined value.
</ins><span class="cx" style="display: block; padding: 0 10px"> settype( $combined, $type );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> return $combined;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2061,8 +2080,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Simple wrapper for saving object to the internal cache.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param string $derived_key Key to save value under.
- * @param mixed $value Object value.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param string $derived_key Key to save value under.
+ * @param mixed $value Object value.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function add_to_internal_cache( $derived_key, $value ) {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( is_object( $value ) ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2075,8 +2094,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="cx" style="display: block; padding: 0 10px"> * Determines if a no_mc_group exists in a group of groups.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param mixed $groups The groups to search.
- * @return bool True if a no_mc_group is present; false if a no_mc_group is not present.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param mixed $groups The groups to search.
+ * @return bool True if a no_mc_group is present; false if a no_mc_group is not present.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function contains_no_mc_group( $groups ) {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( is_scalar( $groups ) ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2097,13 +2116,15 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Add global groups.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Adds global groups.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @author Ryan Boren This function comes straight from the original WP Memcached Object cache
- * @link http://wordpress.org/extend/plugins/memcached/
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * This function comes straight from the original WP Memcached Object cache.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param array $groups Array of groups.
- * @return void
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @author Ryan Boren
+ * @link http://wordpress.org/extend/plugins/memcached/
+ *
+ * @param array $groups Array of groups.
+ * @return void
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function add_global_groups( $groups ) {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! is_array( $groups ) ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2115,13 +2136,15 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Add non-persistent groups.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Adds non-persistent groups.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @author Ryan Boren This function comes straight from the original WP Memcached Object cache
- * @link http://wordpress.org/extend/plugins/memcached/
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * This function comes straight from the original WP Memcached Object cache.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param array $groups Array of groups.
- * @return void
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @author Ryan Boren
+ * @link http://wordpress.org/extend/plugins/memcached/
+ *
+ * @param array $groups Array of groups.
+ * @return void
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function add_non_persistent_groups( $groups ) {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! is_array( $groups ) ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2133,11 +2156,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Get a value specifically from the internal, run-time cache, not memcached.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Gets a value specifically from the internal, run-time cache, not memcached.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param int|string $key Key value.
- * @param int|string $group Group that the value belongs to.
- * @return bool|mixed Value on success; false on failure.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param int|string $key Key value.
+ * @param int|string $group Group that the value belongs to.
+ * @return bool|mixed Value on success, false on failure.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function get_from_runtime_cache( $key, $group ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $derived_key = $this->buildKey( $key, $group );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2150,9 +2173,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * Switch blog prefix, which changes the cache that is accessed.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * Switches blog prefix, which changes the cache that is accessed.
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @param int $blog_id Blog to switch to.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @param int $blog_id Blog to switch to.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @return void
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> public function switch_to_blog( $blog_id ) {
</span></span></pre>
</div>
</div>
</body>
</html>