Make WordPress Core

Changeset 47121


Ignore:
Timestamp:
01/29/2020 12:36:17 AM (5 years ago)
Author:
SergeyBiryukov
Message:

Docs: Improve DocBlocks in phpunit/includes/object-cache.php per the documentation standards.

See #48303.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/includes/object-cache.php

    r46586 r47121  
    66 * returns false.
    77 *
    8  * @link http://www.php.net/manual/en/memcached.add.php
    9  *
    10  * @param string    $key        The key under which to store the value.
    11  * @param mixed     $value      The value to store.
    12  * @param string    $group      The group value appended to the $key.
    13  * @param int       $expiration The expiration time, defaults to 0.
    14  * @return bool                 Returns TRUE on success or FALSE on failure.
     8 * @link https://www.php.net/manual/en/memcached.add.php
     9 *
     10 * @param string $key        The key under which to store the value.
     11 * @param mixed  $value      The value to store.
     12 * @param string $group      The group value appended to the $key.
     13 * @param int    $expiration The expiration time, defaults to 0.
     14 * @return bool True on success, false on failure.
    1515 */
    1616function wp_cache_add( $key, $value, $group = '', $expiration = 0 ) {
     
    2727 * specified server_key.
    2828 *
    29  * @link http://www.php.net/manual/en/memcached.addbykey.php
    30  *
    31  * @param string    $server_key    The key identifying the server to store the value on.
    32  * @param string    $key            The key under which to store the value.
    33  * @param mixed     $value          The value to store.
    34  * @param string    $group          The group value appended to the $key.
    35  * @param int       $expiration    The expiration time, defaults to 0.
    36  * @return bool                     Returns TRUE on success or FALSE on failure.
     29 * @link https://www.php.net/manual/en/memcached.addbykey.php
     30 *
     31 * @param string $server_key The key identifying the server to store the value on.
     32 * @param string $key        The key under which to store the value.
     33 * @param mixed  $value      The value to store.
     34 * @param string $group      The group value appended to the $key.
     35 * @param int    $expiration The expiration time, defaults to 0.
     36 * @return bool True on success, false on failure.
    3737 */
    3838function wp_cache_add_by_key( $server_key, $key, $value, $group = '', $expiration = 0 ) {
     
    4242
    4343/**
    44  * Add a single server to the list of Memcached servers.
    45  *
    46  * @link http://www.php.net/manual/en/memcached.addserver.php
    47  *
    48  * @param string        $host   The hostname of the memcache server.
    49  * @param int           $port   The port on which memcache is running.
    50  * @param int           $weight The weight of the server relative to the total weight of all the servers in the pool.
    51  * @return bool                 Returns TRUE on success or FALSE on failure.
     44 * Adds a single server to the list of Memcached servers.
     45 *
     46 * @link https://www.php.net/manual/en/memcached.addserver.php
     47 *
     48 * @param string $host   The hostname of the memcache server.
     49 * @param int    $port   The port on which memcache is running.
     50 * @param int    $weight The weight of the server relative to the total weight
     51 *                       of all the servers in the pool.
     52 * @return bool True on success, false on failure.
    5253 */
    5354function wp_cache_add_server( $host, $port, $weight = 0 ) {
     
    6263 * weight value: $servers = array( array( '127.0.0.1', 11211, 0 ) );
    6364 *
    64  * @link http://www.php.net/manual/en/memcached.addservers.php
    65  *
    66  * @param array     $servers    Array of server to register.
    67  * @return bool                 True on success; false on failure.
     65 * @link https://www.php.net/manual/en/memcached.addservers.php
     66 *
     67 * @param array $servers Array of server to register.
     68 * @return bool True on success, false on failure.
    6869 */
    6970function wp_cache_add_servers( $servers ) {
     
    7374
    7475/**
    75  * Append data to an existing item.
    76  *
    77  * This method should throw an error if it is used with compressed data. This
    78  * is an expected behavior. Memcached casts the value to be appended to the initial value to the
    79  * type of the initial value. Be careful as this leads to unexpected behavior at times. Due to
    80  * how memcached treats types, the behavior has been mimicked in the internal cache to produce
    81  * similar results and improve consistency. It is recommend that appends only occur with data of
     76 * Appends data to an existing item.
     77 *
     78 * This method should throw an error if it is used with compressed data.
     79 * This is an expected behavior. Memcached casts the value to be appended to the initial value
     80 * to the type of the initial value. Be careful as this leads to unexpected behavior at times.
     81 * Due to how memcached treats types, the behavior has been mimicked in the internal cache to produce
     82 * similar results and improve consistency. It is recommended that appends only occur with data of
    8283 * the same type.
    8384 *
    84  * @link http://www.php.net/manual/en/memcached.append.php
    85  *
    86  * @param string    $key    The key under which to store the value.
    87  * @param mixed     $value  Must be string as appending mixed values is not well-defined
    88  * @param string    $group The group value appended to the $key.
    89  * @return bool             Returns TRUE on success or FALSE on failure.
     85 * @link https://www.php.net/manual/en/memcached.append.php
     86 *
     87 * @param string $key   The key under which to store the value.
     88 * @param mixed  $value Must be string as appending mixed values is not well-defined.
     89 * @param string $group The group value appended to the $key.
     90 * @return bool True on success, false on failure.
    9091 */
    9192function wp_cache_append( $key, $value, $group = '' ) {
     
    9596
    9697/**
    97  * Append data to an existing item by server key.
    98  *
    99  * This method should throw an error if it is used with compressed data. This
    100  * is an expected behavior. Memcached casts the value to be appended to the initial value to the
    101  * type of the initial value. Be careful as this leads to unexpected behavior at times. Due to
    102  * how memcached treats types, the behavior has been mimicked in the internal cache to produce
    103  * similar results and improve consistency. It is recommend that appends only occur with data of
     98 * Appends data to an existing item by server key.
     99 *
     100 * This method should throw an error if it is used with compressed data.
     101 * This is an expected behavior. Memcached casts the value to be appended to the initial value
     102 * to the type of the initial value. Be careful as this leads to unexpected behavior at times.
     103 * Due to how memcached treats types, the behavior has been mimicked in the internal cache to produce
     104 * similar results and improve consistency. It is recommended that appends only occur with data of
    104105 * the same type.
    105106 *
    106  * @link http://www.php.net/manual/en/memcached.appendbykey.php
    107  *
    108  * @param string    $server_key    The key identifying the server to store the value on.
    109  * @param string    $key            The key under which to store the value.
    110  * @param mixed     $value          Must be string as appending mixed values is not well-defined
    111  * @param string    $group          The group value appended to the $key.
    112  * @return bool                     Returns TRUE on success or FALSE on failure.
     107 * @link https://www.php.net/manual/en/memcached.appendbykey.php
     108 *
     109 * @param string $server_key The key identifying the server to store the value on.
     110 * @param string $key        The key under which to store the value.
     111 * @param mixed  $value      Must be string as appending mixed values is not well-defined.
     112 * @param string $group      The group value appended to the $key.
     113 * @return bool True on success, false on failure.
    113114 */
    114115function wp_cache_append_by_key( $server_key, $key, $value, $group = '' ) {
     
    120121 * Performs a "check and set" to store data.
    121122 *
    122  * The set will be successful only if the no other request has updated the value since it was fetched by
    123  * this request.
    124  *
    125  * @link http://www.php.net/manual/en/memcached.cas.php
    126  *
    127  * @param float     $cas_token  Unique value associated with the existing item. Generated by memcached.
    128  * @param string    $key        The key under which to store the value.
    129  * @param mixed     $value      The value to store.
    130  * @param string    $group      The group value appended to the $key.
    131  * @param int       $expiration The expiration time, defaults to 0.
    132  * @return bool                 Returns TRUE on success or FALSE on failure.
     123 * The set will be successful only if the no other request has updated the value
     124 * since it was fetched by this request.
     125 *
     126 * @link https://www.php.net/manual/en/memcached.cas.php
     127 *
     128 * @param float  $cas_token  Unique value associated with the existing item. Generated by memcached.
     129 * @param string $key        The key under which to store the value.
     130 * @param mixed  $value      The value to store.
     131 * @param string $group      The group value appended to the $key.
     132 * @param int    $expiration The expiration time, defaults to 0.
     133 * @return bool True on success, false on failure.
    133134 */
    134135function wp_cache_cas( $cas_token, $key, $value, $group = '', $expiration = 0 ) {
     
    140141 * Performs a "check and set" to store data with a server key.
    141142 *
    142  * The set will be successful only if the no other request has updated the value since it was fetched by
    143  * this request.
    144  *
    145  * @link http://www.php.net/manual/en/memcached.casbykey.php
    146  *
    147  * @param string    $server_key The key identifying the server to store the value on.
    148  * @param float     $cas_token  Unique value associated with the existing item. Generated by memcached.
    149  * @param string    $key        The key under which to store the value.
    150  * @param mixed     $value      The value to store.
    151  * @param string    $group      The group value appended to the $key.
    152  * @param int       $expiration The expiration time, defaults to 0.
    153  * @return bool                 Returns TRUE on success or FALSE on failure.
     143 * The set will be successful only if the no other request has updated the value
     144 * since it was fetched by this request.
     145 *
     146 * @link https://www.php.net/manual/en/memcached.casbykey.php
     147 *
     148 * @param string $server_key The key identifying the server to store the value on.
     149 * @param float  $cas_token  Unique value associated with the existing item. Generated by memcached.
     150 * @param string $key        The key under which to store the value.
     151 * @param mixed  $value      The value to store.
     152 * @param string $group      The group value appended to the $key.
     153 * @param int    $expiration The expiration time, defaults to 0.
     154 * @return bool True on success, false on failure.
    154155 */
    155156function wp_cache_cas_by_key( $cas_token, $server_key, $key, $value, $group = '', $expiration = 0 ) {
     
    161162 * Closes the cache.
    162163 *
    163  * This function has ceased to do anything since WordPress 2.5. The
    164  * functionality was removed along with the rest of the persistent cache. This
    165  * does not mean that plugins can't implement this function when they need to
    166  * make sure that the cache is cleaned up after WordPress no longer needs it.
     164 * This function has ceased to do anything since WordPress 2.5.
     165 * The functionality was removed along with the rest of the persistent cache.
     166 * This does not mean that plugins can't implement this function when they need
     167 * to make sure that the cache is cleaned up after WordPress no longer needs it.
    167168 *
    168169 * @since 2.0.0
    169170 *
    170  * @return  bool    Always returns True
     171 * @return bool Always returns true.
    171172 */
    172173function wp_cache_close() {
     
    175176
    176177/**
    177  * Decrement a numeric item's value.
    178  *
    179  * @link http://www.php.net/manual/en/memcached.decrement.php
    180  *
    181  * @param string    $key    The key under which to store the value.
    182  * @param int       $offset The amount by which to decrement the item's value.
    183  * @param string    $group  The group value appended to the $key.
    184  * @return int|bool         Returns item's new value on success or FALSE on failure.
     178 * Decrements a numeric item's value.
     179 *
     180 * @link https://www.php.net/manual/en/memcached.decrement.php
     181 *
     182 * @param string $key    The key under which to store the value.
     183 * @param int    $offset The amount by which to decrement the item's value.
     184 * @param string $group  The group value appended to the $key.
     185 * @return int|bool Item's new value on success, false on failure.
    185186 */
    186187function wp_cache_decrement( $key, $offset = 1, $group = '' ) {
     
    190191
    191192/**
    192  * Decrement a numeric item's value.
    193  *
    194  * Same as wp_cache_decrement. Original WordPress caching backends use wp_cache_decr. I
    195  * want both spellings to work.
    196  *
    197  * @link http://www.php.net/manual/en/memcached.decrement.php
    198  *
    199  * @param string    $key    The key under which to store the value.
    200  * @param int       $offset The amount by which to decrement the item's value.
    201  * @param string    $group  The group value appended to the $key.
    202  * @return int|bool         Returns item's new value on success or FALSE on failure.
     193 * Decrements a numeric item's value.
     194 *
     195 * This is the same as wp_cache_decrement(), but kept for backward compatibility.
     196 * The original WordPress caching backends use wp_cache_decr().
     197 *
     198 * @link https://www.php.net/manual/en/memcached.decrement.php
     199 *
     200 * @param string $key    The key under which to store the value.
     201 * @param int    $offset The amount by which to decrement the item's value.
     202 * @param string $group  The group value appended to the $key.
     203 * @return int|bool Item's new value on success, false on failure.
    203204 */
    204205function wp_cache_decr( $key, $offset = 1, $group = '' ) {
     
    207208
    208209/**
    209  * Remove the item from the cache.
    210  *
    211  * Remove an item from memcached with identified by $key after $time seconds. The
    212  * $time parameter allows an object to be queued for deletion without immediately
    213  * deleting. Between the time that it is queued and the time it's deleted, add,
    214  * replace, and get will fail, but set will succeed.
    215  *
    216  * @link http://www.php.net/manual/en/memcached.delete.php
    217  *
    218  * @param string    $key    The key under which to store the value.
    219  * @param string    $group The group value appended to the $key.
    220  * @param int       $time   The amount of time the server will wait to delete the item in seconds.
    221  * @return bool             Returns TRUE on success or FALSE on failure.
     210 * Removes the item from the cache.
     211 *
     212 * Removes an item from memcached with identified by $key after $time seconds.
     213 * The $time parameter allows an object to be queued for deletion without
     214 * immediately deleting. Between the time that it is queued and the time it's deleted,
     215 * add, replace, and get will fail, but set will succeed.
     216 *
     217 * @link https://www.php.net/manual/en/memcached.delete.php
     218 *
     219 * @param string $key   The key under which to store the value.
     220 * @param string $group The group value appended to the $key.
     221 * @param int    $time  The amount of time the server will wait to delete the item in seconds.
     222 * @return bool True on success, false on failure.
    222223 */
    223224function wp_cache_delete( $key, $group = '', $time = 0 ) {
     
    227228
    228229/**
    229  * Remove the item from the cache by server key.
    230  *
    231  * Remove an item from memcached with identified by $key after $time seconds. The
    232  * $time parameter allows an object to be queued for deletion without immediately
    233  * deleting. Between the time that it is queued and the time it's deleted, add,
    234  * replace, and get will fail, but set will succeed.
    235  *
    236  * @link http://www.php.net/manual/en/memcached.deletebykey.php
    237  *
    238  * @param string        $server_key The key identifying the server to store the value on.
    239  * @param string        $key        The key under which to store the value.
    240  * @param string        $group      The group value appended to the $key.
    241  * @param int           $time       The amount of time the server will wait to delete the item in seconds.
    242  * @return bool                     Returns TRUE on success or FALSE on failure.
     230 * Removes the item from the cache by server key.
     231 *
     232 * Removes an item from memcached with identified by $key after $time seconds.
     233 * The $time parameter allows an object to be queued for deletion without
     234 * immediately deleting. Between the time that it is queued and the time it's deleted,
     235 * add, replace, and get will fail, but set will succeed.
     236 *
     237 * @link https://www.php.net/manual/en/memcached.deletebykey.php
     238 *
     239 * @param string $server_key The key identifying the server to store the value on.
     240 * @param string $key        The key under which to store the value.
     241 * @param string $group      The group value appended to the $key.
     242 * @param int    $time       The amount of time the server will wait to delete the item in seconds.
     243 * @return bool True on success, false on failure.
    243244 */
    244245function wp_cache_delete_by_key( $server_key, $key, $group = '', $time = 0 ) {
     
    248249
    249250/**
    250  * Fetch the next result.
    251  *
    252  * @link http://www.php.net/manual/en/memcached.fetch.php
    253  *
    254  * @return  array|bool   Returns the next result or FALSE otherwise.
     251 * Fetches the next result.
     252 *
     253 * @link https://www.php.net/manual/en/memcached.fetch.php
     254 *
     255 * @return array|false The next result on success, false on failure.
    255256 */
    256257function wp_cache_fetch() {
     
    260261
    261262/**
    262  * Fetch all remaining results from the last request.
    263  *
    264  * @link http://www.php.net/manual/en/memcached.fetchall.php
    265  *
    266  * @return  array|bool  Returns the results or FALSE on failure.
     263 * Fetches all remaining results from the last request.
     264 *
     265 * @link https://www.php.net/manual/en/memcached.fetchall.php
     266 *
     267 * @return array|false The results on success, false on failure.
    267268 */
    268269function wp_cache_fetch_all() {
     
    272273
    273274/**
    274  * Invalidate all items in the cache.
    275  *
    276  * @link http://www.php.net/manual/en/memcached.flush.php
    277  *
    278  * @param int       $delay Number of seconds to wait before invalidating the items.
    279  * @return bool             Returns TRUE on success or FALSE on failure.
     275 * Invalidates all items in the cache.
     276 *
     277 * @link https://www.php.net/manual/en/memcached.flush.php
     278 *
     279 * @param int $delay Number of seconds to wait before invalidating the items.
     280 * @return bool True on success, false on failure.
    280281 */
    281282function wp_cache_flush( $delay = 0 ) {
     
    285286
    286287/**
    287  * Retrieve object from cache.
    288  *
    289  * Gets an object from cache based on $key and $group. In order to fully support the $cache_cb and $cas_token
    290  * parameters, the runtime cache is ignored by this function if either of those values are set. If either of
    291  * those values are set, the request is made directly to the memcached server for proper handling of the
    292  * callback and/or token.
    293  *
    294  * Note that the $deprecated and $found args are only here for compatibility with the native wp_cache_get function.
    295  *
    296  * @link http://www.php.net/manual/en/memcached.get.php
    297  *
    298  * @param string        $key        The key under which to store the value.
    299  * @param string        $group      The group value appended to the $key.
    300  * @param bool          $force      Whether or not to force a cache invalidation.
    301  * @param null|bool     $found      Variable passed by reference to determine if the value was found or not.
    302  * @param null|string   $cache_cb   Read-through caching callback.
    303  * @param null|float    $cas_token  The variable to store the CAS token in.
    304  * @return bool|mixed               Cached object value.
     288 * Retrieves object from cache.
     289 *
     290 * Gets an object from cache based on $key and $group. In order to fully support
     291 * the $cache_cb and $cas_token parameters, the runtime cache is ignored by this function
     292 * if either of those values are set. In that case, the request is made directly
     293 * to the memcached server for proper handling of the callback and/or token.
     294 *
     295 * Note that the $deprecated and $found args are only here for compatibility
     296 * with the native wp_cache_get() function.
     297 *
     298 * @link https://www.php.net/manual/en/memcached.get.php
     299 *
     300 * @param string      $key       The key under which to store the value.
     301 * @param string      $group     The group value appended to the $key.
     302 * @param bool        $force     Whether or not to force a cache invalidation.
     303 * @param null|bool   $found     Variable passed by reference to determine if the value was found or not.
     304 * @param null|string $cache_cb  Read-through caching callback.
     305 * @param null|float  $cas_token The variable to store the CAS token in.
     306 * @return bool|mixed Cached object value.
    305307 */
    306308function wp_cache_get( $key, $group = '', $force = false, &$found = null, $cache_cb = null, &$cas_token = null ) {
     
    315317
    316318/**
    317  * Retrieve object from cache from specified server.
    318  *
    319  * Gets an object from cache based on $key, $group and $server_key. In order to fully support the $cache_cb and $cas_token
    320  * parameters, the runtime cache is ignored by this function if either of those values are set. If either of
    321  * those values are set, the request is made directly to the memcached server for proper handling of the
    322  * callback and/or token.
    323  *
    324  * @link http://www.php.net/manual/en/memcached.getbykey.php
    325  *
    326  * @param string        $server_key The key identifying the server to store the value on.
    327  * @param string        $key        The key under which to store the value.
    328  * @param string        $group      The group value appended to the $key.
    329  * @param bool          $force      Whether or not to force a cache invalidation.
    330  * @param null|bool     $found      Variable passed by reference to determine if the value was found or not.
    331  * @param null|string   $cache_cb   Read-through caching callback.
    332  * @param null|float    $cas_token  The variable to store the CAS token in.
    333  * @return bool|mixed               Cached object value.
     319 * Retrieves object from cache from specified server.
     320 *
     321 * Gets an object from cache based on $key, $group, and $server_key. In order to fully support
     322 * the $cache_cb and $cas_token parameters, the runtime cache is ignored by this function
     323 * if either of those values are set. In that case, the request is made directly
     324 * to the memcached server for proper handling of the callback and/or token.
     325 *
     326 * @link https://www.php.net/manual/en/memcached.getbykey.php
     327 *
     328 * @param string      $server_key The key identifying the server to store the value on.
     329 * @param string      $key        The key under which to store the value.
     330 * @param string      $group      The group value appended to the $key.
     331 * @param bool        $force      Whether or not to force a cache invalidation.
     332 * @param null|bool   $found      Variable passed by reference to determine if the value was found or not.
     333 * @param null|string $cache_cb   Read-through caching callback.
     334 * @param null|float  $cas_token  The variable to store the CAS token in.
     335 * @return bool|mixed Cached object value.
    334336 */
    335337function wp_cache_get_by_key( $server_key, $key, $group = '', $force = false, &$found = null, $cache_cb = null, &$cas_token = null ) {
     
    344346
    345347/**
    346  * Request multiple keys without blocking.
    347  *
    348  * @link http://www.php.net/manual/en/memcached.getdelayed.php
    349  *
    350  * @param string|array  $keys       Array or string of key(s) to request.
    351  * @param string|array  $groups     Array or string of group(s) for the key(s). See buildKeys for more on how these are handled.
    352  * @param bool          $with_cas   Whether to request CAS token values also.
    353  * @param null          $value_cb   The result callback or NULL.
    354  * @return bool                     Returns TRUE on success or FALSE on failure.
     348 * Requests multiple keys without blocking.
     349 *
     350 * @link https://www.php.net/manual/en/memcached.getdelayed.php
     351 *
     352 * @param string|array $keys     Array or string of key(s) to request.
     353 * @param string|array $groups   Array or string of group(s) for the key(s).
     354 *                               See buildKeys for more on how these are handled.
     355 * @param bool         $with_cas Whether to request CAS token values also.
     356 * @param null         $value_cb The result callback or null.
     357 * @return bool True on success, false on failure.
    355358 */
    356359function wp_cache_get_delayed( $keys, $groups = '', $with_cas = false, $value_cb = null ) {
     
    360363
    361364/**
    362  * Request multiple keys without blocking from a specified server.
    363  *
    364  * @link http://www.php.net/manual/en/memcached.getdelayed.php
    365  *
    366  * @param string        $server_key The key identifying the server to store the value on.
    367  * @param string|array  $keys       Array or string of key(s) to request.
    368  * @param string|array  $groups     Array or string of group(s) for the key(s). See buildKeys for more on how these are handled.
    369  * @param bool          $with_cas   Whether to request CAS token values also.
    370  * @param null          $value_cb   The result callback or NULL.
    371  * @return bool                     Returns TRUE on success or FALSE on failure.
     365 * Requests multiple keys without blocking from a specified server.
     366 *
     367 * @link https://www.php.net/manual/en/memcached.getdelayed.php
     368 *
     369 * @param string       $server_key The key identifying the server to store the value on.
     370 * @param string|array $keys       Array or string of key(s) to request.
     371 * @param string|array $groups     Array or string of group(s) for the key(s).
     372 *                                 See buildKeys for more on how these are handled.
     373 * @param bool         $with_cas   Whether to request CAS token values also.
     374 * @param null         $value_cb   The result callback or null.
     375 * @return bool True on success, false on failure.
    372376 */
    373377function wp_cache_get_delayed_by_key( $server_key, $keys, $groups = '', $with_cas = false, $value_cb = null ) {
     
    381385 * See the buildKeys method definition to understand the $keys/$groups parameters.
    382386 *
    383  * @link http://www.php.net/manual/en/memcached.getmulti.php
    384  *
    385  * @param array         $keys       Array of keys to retrieve.
    386  * @param string|array  $groups     If string, used for all keys. If arrays, corresponds with the $keys array.
    387  * @param null|array    $cas_tokens The variable to store the CAS tokens for the found items.
    388  * @param int           $flags      The flags for the get operation.
    389  * @return bool|array               Returns the array of found items or FALSE on failure.
     387 * @link https://www.php.net/manual/en/memcached.getmulti.php
     388 *
     389 * @param array        $keys       Array of keys to retrieve.
     390 * @param string|array $groups     If string, used for all keys.
     391 *                                 If arrays, corresponds with the $keys array.
     392 * @param null|array   $cas_tokens The variable to store the CAS tokens for the found items.
     393 * @param int          $flags      The flags for the get operation.
     394 * @return bool|array The array of found items on success, false on failure.
    390395 */
    391396function wp_cache_get_multi( $keys, $groups = '', &$cas_tokens = null, $flags = null ) {
     
    404409 * See the buildKeys method definition to understand the $keys/$groups parameters.
    405410 *
    406  * @link http://www.php.net/manual/en/memcached.getmultibykey.php
    407  *
    408  * @param string        $server_key The key identifying the server to store the value on.
    409  * @param array         $keys       Array of keys to retrieve.
    410  * @param string|array  $groups     If string, used for all keys. If arrays, corresponds with the $keys array.
    411  * @param null|array    $cas_tokens The variable to store the CAS tokens for the found items.
    412  * @param int           $flags      The flags for the get operation.
    413  * @return bool|array               Returns the array of found items or FALSE on failure.
     411 * @link https://www.php.net/manual/en/memcached.getmultibykey.php
     412 *
     413 * @param string       $server_key The key identifying the server to store the value on.
     414 * @param array        $keys       Array of keys to retrieve.
     415 * @param string|array $groups     If string, used for all keys.
     416 *                                 If arrays, corresponds with the $keys array.
     417 * @param null|array   $cas_tokens The variable to store the CAS tokens for the found items.
     418 * @param int          $flags      The flags for the get operation.
     419 * @return bool|array The array of found items on success, false on failure.
    414420 */
    415421function wp_cache_get_multi_by_key( $server_key, $keys, $groups = '', &$cas_tokens = null, $flags = null ) {
     
    424430
    425431/**
    426  * Retrieve a Memcached option value.
    427  *
    428  * @link http://www.php.net/manual/en/memcached.getoption.php
    429  *
    430  * @param int   $option One of the Memcached::OPT_* constants.
    431  * @return mixed        Returns the value of the requested option, or FALSE on error.
     432 * Retrieves a Memcached option value.
     433 *
     434 * @link https://www.php.net/manual/en/memcached.getoption.php
     435 *
     436 * @param int $option One of the Memcached::OPT_* constants.
     437 * @return mixed The value of the requested option on success, false on failure.
    432438 */
    433439function wp_cache_get_option( $option ) {
     
    437443
    438444/**
    439  * Return the result code of the last option.
    440  *
    441  * @link http://www.php.net/manual/en/memcached.getresultcode.php
    442  *
    443  * @return int  Result code of the last Memcached operation.
     445 * Returns the result code of the last option.
     446 *
     447 * @link https://www.php.net/manual/en/memcached.getresultcode.php
     448 *
     449 * @return int Result code of the last Memcached operation.
    444450 */
    445451function wp_cache_get_result_code() {
     
    451457 * Return the message describing the result of the last operation.
    452458 *
    453  * @link http://www.php.net/manual/en/memcached.getresultmessage.php
    454  *
    455  * @return string   Message describing the result of the last Memcached operation.
     459 * @link https://www.php.net/manual/en/memcached.getresultmessage.php
     460 *
     461 * @return string Message describing the result of the last Memcached operation.
    456462 */
    457463function wp_cache_get_result_message() {
     
    461467
    462468/**
    463  * Get server information by key.
    464  *
    465  * @link http://www.php.net/manual/en/memcached.getserverbykey.php
    466  *
    467  * @param string    $server_key The key identifying the server to store the value on.
    468  * @return array                Array with host, post, and weight on success, FALSE on failure.
     469 * Gets server information by key.
     470 *
     471 * @link https://www.php.net/manual/en/memcached.getserverbykey.php
     472 *
     473 * @param string $server_key The key identifying the server to store the value on.
     474 * @return array Array with host, post, and weight on success, fales on failure.
    469475 */
    470476function wp_cache_get_server_by_key( $server_key ) {
     
    474480
    475481/**
    476  * Get the list of servers in the pool.
    477  *
    478  * @link http://www.php.net/manual/en/memcached.getserverlist.php
    479  *
    480  * @return array    The list of all servers in the server pool.
     482 * Gets the list of servers in the pool.
     483 *
     484 * @link https://www.php.net/manual/en/memcached.getserverlist.php
     485 *
     486 * @return array The list of all servers in the server pool.
    481487 */
    482488function wp_cache_get_server_list() {
     
    486492
    487493/**
    488  * Get server pool statistics.
    489  *
    490  * @link http://www.php.net/manual/en/memcached.getstats.php
    491  *
    492  * @return array    Array of server statistics, one entry per server.
     494 * Gets server pool statistics.
     495 *
     496 * @link https://www.php.net/manual/en/memcached.getstats.php
     497 *
     498 * @return array Array of server statistics, one entry per server.
    493499 */
    494500function wp_cache_get_stats() {
     
    498504
    499505/**
    500  * Get server pool memcached version information.
    501  *
    502  * @link http://www.php.net/manual/en/memcached.getversion.php
    503  *
    504  * @return array    Array of server versions, one entry per server.
     506 * Gets server pool memcached version information.
     507 *
     508 * @link https://www.php.net/manual/en/memcached.getversion.php
     509 *
     510 * @return array Array of server versions, one entry per server.
    505511 */
    506512function wp_cache_get_version() {
     
    510516
    511517/**
    512  * Increment a numeric item's value.
    513  *
    514  * @link http://www.php.net/manual/en/memcached.increment.php
    515  *
    516  * @param string    $key    The key under which to store the value.
    517  * @param int       $offset The amount by which to increment the item's value.
    518  * @param string    $group  The group value appended to the $key.
    519  * @return int|bool         Returns item's new value on success or FALSE on failure.
     518 * Increments a numeric item's value.
     519 *
     520 * @link https://www.php.net/manual/en/memcached.increment.php
     521 *
     522 * @param string $key    The key under which to store the value.
     523 * @param int    $offset The amount by which to increment the item's value.
     524 * @param string $group  The group value appended to the $key.
     525 * @return int|bool Item's new value on success, false on failure.
    520526 */
    521527function wp_cache_increment( $key, $offset = 1, $group = '' ) {
     
    525531
    526532/**
    527  * Increment a numeric item's value.
    528  *
    529  * This is the same as wp_cache_increment, but kept for back compatibility. The original
    530  * WordPress caching backends use wp_cache_incr. I want both to work.
    531  *
    532  * @link http://www.php.net/manual/en/memcached.increment.php
    533  *
    534  * @param string    $key    The key under which to store the value.
    535  * @param int       $offset The amount by which to increment the item's value.
    536  * @param string    $group  The group value appended to the $key.
    537  * @return int|bool         Returns item's new value on success or FALSE on failure.
     533 * Increments a numeric item's value.
     534 *
     535 * This is the same as wp_cache_increment(), but kept for backward compatibility.
     536 * The original WordPress caching backends use wp_cache_incr().
     537 *
     538 * @link https://www.php.net/manual/en/memcached.increment.php
     539 *
     540 * @param string $key    The key under which to store the value.
     541 * @param int    $offset The amount by which to increment the item's value.
     542 * @param string $group  The group value appended to the $key.
     543 * @return int|bool Item's new value on success, false on failure.
    538544 */
    539545function wp_cache_incr( $key, $offset = 1, $group = '' ) {
     
    542548
    543549/**
    544  * Prepend data to an existing item.
     550 * Prepends data to an existing item.
    545551 *
    546552 * This method should throw an error if it is used with compressed data. This is an expected behavior.
    547  * Memcached casts the value to be prepended to the initial value to the type of the initial value. Be
    548  * careful as this leads to unexpected behavior at times. For instance, prepending (float) 45.23 to
    549  * (int) 23 will result in 45, because the value is first combined (45.2323) then cast to "integer"
     553 * Memcached casts the value to be prepended to the initial value to the type of the initial value.
     554 * Be careful as this leads to unexpected behavior at times. For instance, prepending (float) 45.23
     555 * to (int) 23 will result in 45, because the value is first combined (45.2323) then cast to "integer"
    550556 * (the original value), which will be (int) 45. Due to how memcached treats types, the behavior has been
    551  * mimicked in the internal cache to produce similar results and improve consistency. It is recommend
     557 * mimicked in the internal cache to produce similar results and improve consistency. It is recommended
    552558 * that prepends only occur with data of the same type.
    553559 *
    554  * @link http://www.php.net/manual/en/memcached.prepend.php
    555  *
    556  * @param string    $key    The key under which to store the value.
    557  * @param string    $value Must be string as prepending mixed values is not well-defined.
    558  * @param string    $group The group value prepended to the $key.
    559  * @return bool             Returns TRUE on success or FALSE on failure.
     560 * @link https://www.php.net/manual/en/memcached.prepend.php
     561 *
     562 * @param string $key   The key under which to store the value.
     563 * @param string $value Must be string as prepending mixed values is not well-defined.
     564 * @param string $group The group value prepended to the $key.
     565 * @return bool True on success, false on failure.
    560566 */
    561567function wp_cache_prepend( $key, $value, $group = '' ) {
     
    565571
    566572/**
    567  * Append data to an existing item by server key.
     573 * Appends data to an existing item by server key.
    568574 *
    569575 * This method should throw an error if it is used with compressed data. This is an expected behavior.
    570  * Memcached casts the value to be prepended to the initial value to the type of the initial value. Be
    571  * careful as this leads to unexpected behavior at times. For instance, prepending (float) 45.23 to
    572  * (int) 23 will result in 45, because the value is first combined (45.2323) then cast to "integer"
     576 * Memcached casts the value to be prepended to the initial value to the type of the initial value.
     577 * Be careful as this leads to unexpected behavior at times. For instance, prepending (float) 45.23
     578 * to (int) 23 will result in 45, because the value is first combined (45.2323) then cast to "integer"
    573579 * (the original value), which will be (int) 45. Due to how memcached treats types, the behavior has been
    574  * mimicked in the internal cache to produce similar results and improve consistency. It is recommend
     580 * mimicked in the internal cache to produce similar results and improve consistency. It is recommended
    575581 * that prepends only occur with data of the same type.
    576582 *
    577  * @link http://www.php.net/manual/en/memcached.prependbykey.php
    578  *
    579  * @param string    $server_key    The key identifying the server to store the value on.
    580  * @param string    $key            The key under which to store the value.
    581  * @param string    $value          Must be string as prepending mixed values is not well-defined.
    582  * @param string    $group          The group value prepended to the $key.
    583  * @return bool                     Returns TRUE on success or FALSE on failure.
     583 * @link https://www.php.net/manual/en/memcached.prependbykey.php
     584 *
     585 * @param string $server_key The key identifying the server to store the value on.
     586 * @param string $key        The key under which to store the value.
     587 * @param string $value      Must be string as prepending mixed values is not well-defined.
     588 * @param string $group      The group value prepended to the $key.
     589 * @return bool True on success, false on failure.
    584590 */
    585591function wp_cache_prepend_by_key( $server_key, $key, $value, $group = '' ) {
     
    591597 * Replaces a value in cache.
    592598 *
    593  * This method is similar to "add"; however, is does not successfully set a value if
    594  * the object's key is not already set in cache.
    595  *
    596  * @link http://www.php.net/manual/en/memcached.replace.php
    597  *
    598  * @param string    $key        The key under which to store the value.
    599  * @param mixed     $value      The value to store.
    600  * @param string    $group      The group value appended to the $key.
    601  * @param int       $expiration The expiration time, defaults to 0.
    602  * @return bool                 Returns TRUE on success or FALSE on failure.
     599 * This method is similar to "add"; however, is does not successfully set a value
     600 * if the object's key is not already set in cache.
     601 *
     602 * @link https://www.php.net/manual/en/memcached.replace.php
     603 *
     604 * @param string $key        The key under which to store the value.
     605 * @param mixed  $value      The value to store.
     606 * @param string $group      The group value appended to the $key.
     607 * @param int    $expiration The expiration time, defaults to 0.
     608 * @return bool True on success, false on failure.
    603609 */
    604610function wp_cache_replace( $key, $value, $group = '', $expiration = 0 ) {
     
    610616 * Replaces a value in cache on a specific server.
    611617 *
    612  * This method is similar to "addByKey"; however, is does not successfully set a value if
    613  * the object's key is not already set in cache.
    614  *
    615  * @link http://www.php.net/manual/en/memcached.addbykey.php
    616  *
    617  * @param string    $server_key    The key identifying the server to store the value on.
    618  * @param string    $key            The key under which to store the value.
    619  * @param mixed     $value          The value to store.
    620  * @param string    $group          The group value appended to the $key.
    621  * @param int       $expiration    The expiration time, defaults to 0.
    622  * @return bool                     Returns TRUE on success or FALSE on failure.
     618 * This method is similar to "addByKey"; however, is does not successfully set a value
     619 * if the object's key is not already set in cache.
     620 *
     621 * @link https://www.php.net/manual/en/memcached.addbykey.php
     622 *
     623 * @param string $server_key The key identifying the server to store the value on.
     624 * @param string $key        The key under which to store the value.
     625 * @param mixed  $value      The value to store.
     626 * @param string $group      The group value appended to the $key.
     627 * @param int    $expiration The expiration time, defaults to 0.
     628 * @return bool True on success, false on failure.
    623629 */
    624630function wp_cache_replace_by_key( $server_key, $key, $value, $group = '', $expiration = 0 ) {
     
    632638 * The value is set whether or not this key already exists in memcached.
    633639 *
    634  * @link http://www.php.net/manual/en/memcached.set.php
    635  *
    636  * @param string    $key        The key under which to store the value.
    637  * @param mixed     $value      The value to store.
    638  * @param string    $group      The group value appended to the $key.
    639  * @param int       $expiration The expiration time, defaults to 0.
    640  * @return bool                 Returns TRUE on success or FALSE on failure.
     640 * @link https://www.php.net/manual/en/memcached.set.php
     641 *
     642 * @param string $key        The key under which to store the value.
     643 * @param mixed  $value      The value to store.
     644 * @param string $group      The group value appended to the $key.
     645 * @param int    $expiration The expiration time, defaults to 0.
     646 * @return bool True on success, false on failure.
    641647 */
    642648function wp_cache_set( $key, $value, $group = '', $expiration = 0 ) {
     
    650656 * The value is set whether or not this key already exists in memcached.
    651657 *
    652  * @link http://www.php.net/manual/en/memcached.set.php
    653  *
    654  * @param string    $server_key    The key identifying the server to store the value on.
    655  * @param string    $key            The key under which to store the value.
    656  * @param mixed     $value          The value to store.
    657  * @param string    $group          The group value appended to the $key.
    658  * @param int       $expiration    The expiration time, defaults to 0.
    659  * @return bool                     Returns TRUE on success or FALSE on failure.
     658 * @link https://www.php.net/manual/en/memcached.set.php
     659 *
     660 * @param string $server_key The key identifying the server to store the value on.
     661 * @param string $key        The key under which to store the value.
     662 * @param mixed  $value      The value to store.
     663 * @param string $group      The group value appended to the $key.
     664 * @param int    $expiration The expiration time, defaults to 0.
     665 * @return bool True on success, false on failure.
    660666 */
    661667function wp_cache_set_by_key( $server_key, $key, $value, $group = '', $expiration = 0 ) {
     
    665671
    666672/**
    667  * Set multiple values to cache at once.
     673 * Sets multiple values to cache at once.
    668674 *
    669675 * By sending an array of $items to this function, all values are saved at once to
     
    673679 * final key for the object.
    674680 *
    675  * @param array         $items      An array of key/value pairs to store on the server.
    676  * @param string|array  $groups     Group(s) to merge with key(s) in $items.
    677  * @param int           $expiration The expiration time, defaults to 0.
    678  * @return bool                     Returns TRUE on success or FALSE on failure.
     681 * @param array        $items      An array of key/value pairs to store on the server.
     682 * @param string|array $groups     Group(s) to merge with key(s) in $items.
     683 * @param int          $expiration The expiration time, defaults to 0.
     684 * @return bool True on success, false on failure.
    679685 */
    680686function wp_cache_set_multi( $items, $groups = '', $expiration = 0 ) {
     
    684690
    685691/**
    686  * Set multiple values to cache at once on specified server.
     692 * Sets multiple values to cache at once on specified server.
    687693 *
    688694 * By sending an array of $items to this function, all values are saved at once to
     
    692698 * final key for the object.
    693699 *
    694  * @param string        $server_key The key identifying the server to store the value on.
    695  * @param array         $items      An array of key/value pairs to store on the server.
    696  * @param string|array  $groups     Group(s) to merge with key(s) in $items.
    697  * @param int           $expiration The expiration time, defaults to 0.
    698  * @return bool                     Returns TRUE on success or FALSE on failure.
     700 * @param string       $server_key The key identifying the server to store the value on.
     701 * @param array        $items      An array of key/value pairs to store on the server.
     702 * @param string|array $groups     Group(s) to merge with key(s) in $items.
     703 * @param int          $expiration The expiration time, defaults to 0.
     704 * @return bool True on success, false on failure.
    699705 */
    700706function wp_cache_set_multi_by_key( $server_key, $items, $groups = 'default', $expiration = 0 ) {
     
    704710
    705711/**
    706  * Set a Memcached option.
    707  *
    708  * @link http://www.php.net/manual/en/memcached.setoption.php
    709  *
    710  * @param int       $option Option name.
    711  * @param mixed     $value  Option value.
    712  * @return bool             Returns TRUE on success or FALSE on failure.
     712 * Sets a Memcached option.
     713 *
     714 * @link https://www.php.net/manual/en/memcached.setoption.php
     715 *
     716 * @param int   $option Option name.
     717 * @param mixed $value  Option value.
     718 * @return bool True on success, false on failure.
    713719 */
    714720function wp_cache_set_option( $option, $value ) {
     
    718724
    719725/**
    720  * Switch blog prefix, which changes the cache that is accessed.
    721  *
    722  * @param  int     $blog_id    Blog to switch to.
     726 * Switches blog prefix, which changes the cache that is accessed.
     727 *
     728 * @param int $blog_id Blog to switch to.
    723729 * @return void
    724730 */
     
    732738 * Sets up Object Cache Global and assigns it.
    733739 *
    734  * @global  WP_Object_Cache     $wp_object_cache    WordPress Object Cache
    735  * @return  void
     740 * @global WP_Object_Cache $wp_object_cache WordPress Object Cache
     741 * @return void
    736742 */
    737743function wp_cache_init() {
     
    743749 * Adds a group or set of groups to the list of non-persistent groups.
    744750 *
    745  * @param   string|array    $groups    A group or an array of groups to add.
    746  * @return  void
     751 * @param string|array $groups A group or an array of groups to add.
     752 * @return void
    747753 */
    748754function wp_cache_add_global_groups( $groups ) {
     
    754760 * Adds a group or set of groups to the list of non-Memcached groups.
    755761 *
    756  * @param   string|array    $groups    A group or an array of groups to add.
    757  * @return  void
     762 * @param string|array $groups A group or an array of groups to add.
     763 * @return void
    758764 */
    759765function wp_cache_add_non_persistent_groups( $groups ) {
     
    815821
    816822    /**
    817      * Instantiate the Memcached class.
     823     * Instantiates the Memcached class.
    818824     *
    819825     * Instantiates the Memcached class and returns adds the servers specified
    820826     * in the $memcached_servers global array.
    821827     *
    822      * @link    http://www.php.net/manual/en/memcached.construct.php
    823      *
    824      * @param   null    $persistent_id      To create an instance that persists between requests, use persistent_id to specify a unique ID for the instance.
     828     * @link https://www.php.net/manual/en/memcached.construct.php
     829     *
     830     * @param null $persistent_id To create an instance that persists between requests,
     831     *                            use persistent_id to specify a unique ID for the instance.
    825832     */
    826833    public function __construct( $persistent_id = null ) {
     
    842849
    843850        /**
    844          * This approach is borrowed from Sivel and Boren. Use the salt for easy cache invalidation and for
    845          * multi single WP installations on the same server.
     851         * This approach is borrowed from Sivel and Boren. Use the salt for easy cache invalidation
     852         * and for multi single WP installations on the same server.
    846853         */
    847854        if ( ! defined( 'WP_CACHE_KEY_SALT' ) ) {
     
    849856        }
    850857
    851         // Assign global and blog prefixes for use with keys
     858        // Assign global and blog prefixes for use with keys.
    852859        if ( function_exists( 'is_multisite' ) ) {
    853860            $this->global_prefix = ( is_multisite() || defined( 'CUSTOM_USER_TABLE' ) && defined( 'CUSTOM_USER_META_TABLE' ) ) ? '' : $table_prefix;
     
    855862        }
    856863
    857         // Setup cacheable values for handling expiration times
     864        // Setup cacheable values for handling expiration times.
    858865        $this->thirty_days = 60 * 60 * 24 * 30;
    859866        $this->now         = time();
     
    866873     * returns false.
    867874     *
    868      * @link    http://www.php.net/manual/en/memcached.add.php
    869      *
    870      * @param   string      $key            The key under which to store the value.
    871      * @param   mixed       $value          The value to store.
    872      * @param   string      $group          The group value appended to the $key.
    873      * @param   int         $expiration    The expiration time, defaults to 0.
    874      * @param   string      $server_key    The key identifying the server to store the value on.
    875      * @param   bool        $by_key         True to store in internal cache by key; false to not store by key
    876      * @return  bool                        Returns TRUE on success or FALSE on failure.
     875     * @link https://www.php.net/manual/en/memcached.add.php
     876     *
     877     * @param string $key        The key under which to store the value.
     878     * @param mixed  $value      The value to store.
     879     * @param string $group      The group value appended to the $key.
     880     * @param int    $expiration The expiration time, defaults to 0.
     881     * @param string $server_key The key identifying the server to store the value on.
     882     * @param bool   $by_key     True to store in internal cache by key; false to not store by key.
     883     * @return bool True on success, false on failure.
    877884     */
    878885    public function add( $key, $value, $group = 'default', $expiration = 0, $server_key = '', $by_key = false ) {
     
    890897        $expiration  = $this->sanitize_expiration( $expiration );
    891898
    892         // If group is a non-Memcached group, save to runtime cache, not Memcached
     899        // If group is a non-Memcached group, save to runtime cache, not Memcached.
    893900        if ( in_array( $group, $this->no_mc_groups, true ) ) {
    894901
    895             // Add does not set the value if the key exists; mimic that here
     902            // Add does not set the value if the key exists; mimic that here.
    896903            if ( isset( $this->cache[ $derived_key ] ) ) {
    897904                return false;
     
    903910        }
    904911
    905         // Save to Memcached
     912        // Save to Memcached.
    906913        if ( $by_key ) {
    907914            $result = $this->m->addByKey( $server_key, $derived_key, $value, $expiration );
     
    910917        }
    911918
    912         // Store in runtime cache if add was successful
     919        // Store in runtime cache if add was successful.
    913920        if ( Memcached::RES_SUCCESS === $this->getResultCode() ) {
    914921            $this->add_to_internal_cache( $derived_key, $value );
     
    926933     * specified server_key.
    927934     *
    928      * @link    http://www.php.net/manual/en/memcached.addbykey.php
    929      *
    930      * @param   string      $server_key    The key identifying the server to store the value on.
    931      * @param   string      $key            The key under which to store the value.
    932      * @param   mixed       $value          The value to store.
    933      * @param   string      $group          The group value appended to the $key.
    934      * @param   int         $expiration    The expiration time, defaults to 0.
    935      * @return  bool                        Returns TRUE on success or FALSE on failure.
     935     * @link https://www.php.net/manual/en/memcached.addbykey.php
     936     *
     937     * @param string $server_key The key identifying the server to store the value on.
     938     * @param string $key        The key under which to store the value.
     939     * @param mixed  $value      The value to store.
     940     * @param string $group      The group value appended to the $key.
     941     * @param int    $expiration The expiration time, defaults to 0.
     942     * @return bool True on success, false on failure.
    936943     */
    937944    public function addByKey( $server_key, $key, $value, $group = 'default', $expiration = 0 ) {
     
    940947
    941948    /**
    942      * Add a single server to the list of Memcached servers.
    943      *
    944      * @link http://www.php.net/manual/en/memcached.addserver.php
    945      *
    946      * @param   string      $host           The hostname of the memcache server.
    947      * @param   int         $port           The port on which memcache is running.
    948      * @param   int         $weight         The weight of the server relative to the total weight of all the servers in the pool.
    949      * @return  bool                        Returns TRUE on success or FALSE on failure.
     949     * Adds a single server to the list of Memcached servers.
     950     *
     951     * @link https://www.php.net/manual/en/memcached.addserver.php
     952     *
     953     * @param string $host   The hostname of the memcache server.
     954     * @param int    $port   The port on which memcache is running.
     955     * @param int    $weight The weight of the server relative to the total weight
     956     *                       of all the servers in the pool.
     957     * @return bool True on success, false on failure.
    950958     */
    951959    public function addServer( $host, $port, $weight = 0 ) {
     
    963971     * weight value: $servers = array( array( '127.0.0.1', 11211, 0 ) );
    964972     *
    965      * @link    http://www.php.net/manual/en/memcached.addservers.php
    966      *
    967      * @param   array       $servers        Array of server to register.
    968      * @return  bool                        True on success; false on failure.
     973     * @link https://www.php.net/manual/en/memcached.addservers.php
     974     *
     975     * @param array $servers Array of server to register.
     976     * @return bool True on success, false on failure.
    969977     */
    970978    public function addServers( $servers ) {
     
    977985
    978986    /**
    979      * Append data to an existing item.
    980      *
    981      * This method should throw an error if it is used with compressed data. This
    982      * is an expected behavior. Memcached casts the value to be appended to the initial value to the
    983      * type of the initial value. Be careful as this leads to unexpected behavior at times. Due to
    984      * how memcached treats types, the behavior has been mimicked in the internal cache to produce
    985      * similar results and improve consistency. It is recommend that appends only occur with data of
     987     * Appends data to an existing item.
     988     *
     989     * This method should throw an error if it is used with compressed data.
     990     * This is an expected behavior. Memcached casts the value to be appended to the initial value
     991     * to the type of the initial value. Be careful as this leads to unexpected behavior at times.
     992     * Due to how memcached treats types, the behavior has been mimicked in the internal cache to produce
     993     * similar results and improve consistency. It is recommended that appends only occur with data of
    986994     * the same type.
    987995     *
    988      * @link    http://www.php.net/manual/en/memcached.append.php
    989      *
    990      * @param   string      $key            The key under which to store the value.
    991      * @param   mixed       $value          Must be string as appending mixed values is not well-defined.
    992      * @param   string      $group          The group value appended to the $key.
    993      * @param   string      $server_key    The key identifying the server to store the value on.
    994      * @param   bool        $by_key         True to store in internal cache by key; false to not store by key
    995      * @return  bool                        Returns TRUE on success or FALSE on failure.
     996     * @link https://www.php.net/manual/en/memcached.append.php
     997     *
     998     * @param string $key        The key under which to store the value.
     999     * @param mixed  $value      Must be string as appending mixed values is not well-defined.
     1000     * @param string $group      The group value appended to the $key.
     1001     * @param string $server_key The key identifying the server to store the value on.
     1002     * @param bool   $by_key     True to store in internal cache by key; false to not store by key.
     1003     * @return bool True on success, false on failure.
    9961004     */
    9971005    public function append( $key, $value, $group = 'default', $server_key = '', $by_key = false ) {
     
    10021010        $derived_key = $this->buildKey( $key, $group );
    10031011
    1004         // If group is a non-Memcached group, append to runtime cache value, not Memcached
     1012        // If group is a non-Memcached group, append to runtime cache value, not Memcached.
    10051013        if ( in_array( $group, $this->no_mc_groups, true ) ) {
    10061014            if ( ! isset( $this->cache[ $derived_key ] ) ) {
     
    10131021        }
    10141022
    1015         // Append to Memcached value
     1023        // Append to Memcached value.
    10161024        if ( $by_key ) {
    10171025            $result = $this->m->appendByKey( $server_key, $derived_key, $value );
     
    10201028        }
    10211029
    1022         // Store in runtime cache if add was successful
     1030        // Store in runtime cache if add was successful.
    10231031        if ( Memcached::RES_SUCCESS === $this->getResultCode() ) {
    10241032            $combined = $this->combine_values( $this->cache[ $derived_key ], $value, 'app' );
     
    10301038
    10311039    /**
    1032      * Append data to an existing item by server key.
    1033      *
    1034      * This method should throw an error if it is used with compressed data. This
    1035      * is an expected behavior. Memcached casts the value to be appended to the initial value to the
    1036      * type of the initial value. Be careful as this leads to unexpected behavior at times. Due to
    1037      * how memcached treats types, the behavior has been mimicked in the internal cache to produce
    1038      * similar results and improve consistency. It is recommend that appends only occur with data of
     1040     * Appends data to an existing item by server key.
     1041     *
     1042     * This method should throw an error if it is used with compressed data.
     1043     * This is an expected behavior. Memcached casts the value to be appended to the initial value
     1044     * to the type of the initial value. Be careful as this leads to unexpected behavior at times.
     1045     * Due to how memcached treats types, the behavior has been mimicked in the internal cache to produce
     1046     * similar results and improve consistency. It is recommended that appends only occur with data of
    10391047     * the same type.
    10401048     *
    1041      * @link    http://www.php.net/manual/en/memcached.appendbykey.php
    1042      *
    1043      * @param   string      $server_key    The key identifying the server to store the value on.
    1044      * @param   string      $key            The key under which to store the value.
    1045      * @param   mixed       $value          Must be string as appending mixed values is not well-defined
    1046      * @param   string      $group          The group value appended to the $key.
    1047      * @return  bool                        Returns TRUE on success or FALSE on failure.
     1049     * @link https://www.php.net/manual/en/memcached.appendbykey.php
     1050     *
     1051     * @param string $server_key The key identifying the server to store the value on.
     1052     * @param string $key        The key under which to store the value.
     1053     * @param mixed  $value      Must be string as appending mixed values is not well-defined.
     1054     * @param string $group      The group value appended to the $key.
     1055     * @return bool True on success, false on failure.
    10481056     */
    10491057    public function appendByKey( $server_key, $key, $value, $group = 'default' ) {
     
    10541062     * Performs a "check and set" to store data.
    10551063     *
    1056      * The set will be successful only if the no other request has updated the value since it was fetched since
    1057      * this request.
    1058      *
    1059      * @link    http://www.php.net/manual/en/memcached.cas.php
    1060      *
    1061      * @param   float       $cas_token      Unique value associated with the existing item. Generated by memcached.
    1062      * @param   string      $key            The key under which to store the value.
    1063      * @param   mixed       $value          The value to store.
    1064      * @param   string      $group          The group value appended to the $key.
    1065      * @param   int         $expiration    The expiration time, defaults to 0.
    1066      * @param   string      $server_key    The key identifying the server to store the value on.
    1067      * @param   bool        $by_key         True to store in internal cache by key; false to not store by key
    1068      * @return  bool                        Returns TRUE on success or FALSE on failure.
     1064     * The set will be successful only if the no other request has updated the value
     1065     * since it was fetched by this request.
     1066     *
     1067     * @link https://www.php.net/manual/en/memcached.cas.php
     1068     *
     1069     * @param float  $cas_token  Unique value associated with the existing item. Generated by memcached.
     1070     * @param string $key        The key under which to store the value.
     1071     * @param mixed  $value      The value to store.
     1072     * @param string $group      The group value appended to the $key.
     1073     * @param int    $expiration The expiration time, defaults to 0.
     1074     * @param string $server_key The key identifying the server to store the value on.
     1075     * @param bool   $by_key     True to store in internal cache by key; false to not store by key.
     1076     * @return bool True on success, false on failure.
    10691077     */
    10701078    public function cas( $cas_token, $key, $value, $group = 'default', $expiration = 0, $server_key = '', $by_key = false ) {
     
    10821090        }
    10831091
    1084         // Save to Memcached
     1092        // Save to Memcached.
    10851093        if ( $by_key ) {
    10861094            $result = $this->m->casByKey( $cas_token, $server_key, $derived_key, $value, $expiration );
     
    10891097        }
    10901098
    1091         // Store in runtime cache if cas was successful
     1099        // Store in runtime cache if cas was successful.
    10921100        if ( Memcached::RES_SUCCESS === $this->getResultCode() ) {
    10931101            $this->add_to_internal_cache( $derived_key, $value );
     
    11001108     * Performs a "check and set" to store data with a server key.
    11011109     *
    1102      * The set will be successful only if the no other request has updated the value since it was fetched by
    1103      * this request.
    1104      *
    1105      * @link    http://www.php.net/manual/en/memcached.casbykey.php
    1106      *
    1107      * @param   string      $server_key    The key identifying the server to store the value on.
    1108      * @param   float       $cas_token      Unique value associated with the existing item. Generated by memcached.
    1109      * @param   string      $key            The key under which to store the value.
    1110      * @param   mixed       $value          The value to store.
    1111      * @param   string      $group          The group value appended to the $key.
    1112      * @param   int         $expiration    The expiration time, defaults to 0.
    1113      * @return  bool                        Returns TRUE on success or FALSE on failure.
     1110     * The set will be successful only if the no other request has updated the value
     1111     * since it was fetched by this request.
     1112     *
     1113     * @link https://www.php.net/manual/en/memcached.casbykey.php
     1114     *
     1115     * @param string $server_key The key identifying the server to store the value on.
     1116     * @param float  $cas_token  Unique value associated with the existing item. Generated by memcached.
     1117     * @param string $key        The key under which to store the value.
     1118     * @param mixed  $value      The value to store.
     1119     * @param string $group      The group value appended to the $key.
     1120     * @param int    $expiration The expiration time, defaults to 0.
     1121     * @return bool True on success, false on failure.
    11141122     */
    11151123    public function casByKey( $cas_token, $server_key, $key, $value, $group = 'default', $expiration = 0 ) {
     
    11181126
    11191127    /**
    1120      * Decrement a numeric item's value.
    1121      *
    1122      * @link http://www.php.net/manual/en/memcached.decrement.php
    1123      *
    1124      * @param string    $key    The key under which to store the value.
    1125      * @param int       $offset The amount by which to decrement the item's value.
    1126      * @param string    $group  The group value appended to the $key.
    1127      * @return int|bool         Returns item's new value on success or FALSE on failure.
     1128     * Decrements a numeric item's value.
     1129     *
     1130     * @link https://www.php.net/manual/en/memcached.decrement.php
     1131     *
     1132     * @param string $key    The key under which to store the value.
     1133     * @param int    $offset The amount by which to decrement the item's value.
     1134     * @param string $group  The group value appended to the $key.
     1135     * @return int|bool Item's new value on success, false on failure.
    11281136     */
    11291137    public function decrement( $key, $offset = 1, $group = 'default' ) {
    11301138        $derived_key = $this->buildKey( $key, $group );
    11311139
    1132         // Decrement values in no_mc_groups
     1140        // Decrement values in no_mc_groups.
    11331141        if ( in_array( $group, $this->no_mc_groups, true ) ) {
    11341142
    1135             // Only decrement if the key already exists and value is 0 or greater (mimics memcached behavior)
     1143            // Only decrement if the key already exists and value is 0 or greater (mimics memcached behavior).
    11361144            if ( isset( $this->cache[ $derived_key ] ) && $this->cache[ $derived_key ] >= 0 ) {
    11371145
    1138                 // If numeric, subtract; otherwise, consider it 0 and do nothing
     1146                // If numeric, subtract; otherwise, consider it 0 and do nothing.
    11391147                if ( is_numeric( $this->cache[ $derived_key ] ) ) {
    11401148                    $this->cache[ $derived_key ] -= (int) $offset;
     
    11431151                }
    11441152
    1145                 // Returned value cannot be less than 0
     1153                // Returned value cannot be less than 0.
    11461154                if ( $this->cache[ $derived_key ] < 0 ) {
    11471155                    $this->cache[ $derived_key ] = 0;
     
    11641172
    11651173    /**
    1166      * Decrement a numeric item's value.
    1167      *
    1168      * Alias for $this->decrement. Other caching backends use this abbreviated form of the function. It *may* cause
    1169      * breakage somewhere, so it is nice to have. This function will also allow the core unit tests to pass.
    1170      *
    1171      * @param string    $key    The key under which to store the value.
    1172      * @param int       $offset The amount by which to decrement the item's value.
    1173      * @param string    $group  The group value appended to the $key.
    1174      * @return int|bool         Returns item's new value on success or FALSE on failure.
     1174     * Decrements a numeric item's value.
     1175     *
     1176     * Alias for $this->decrement(). Other caching backends use this abbreviated form
     1177     * of the function. It *may* cause breakage somewhere, so it is nice to have.
     1178     * This function will also allow the core unit tests to pass.
     1179     *
     1180     * @param string $key    The key under which to store the value.
     1181     * @param int    $offset The amount by which to decrement the item's value.
     1182     * @param string $group  The group value appended to the $key.
     1183     * @return int|bool Item's new value on success, false on failure.
    11751184     */
    11761185    public function decr( $key, $offset = 1, $group = 'default' ) {
     
    11791188
    11801189    /**
    1181      * Remove the item from the cache.
    1182      *
    1183      * Remove an item from memcached with identified by $key after $time seconds. The
    1184      * $time parameter allows an object to be queued for deletion without immediately
    1185      * deleting. Between the time that it is queued and the time it's deleted, add,
    1186      * replace, and get will fail, but set will succeed.
    1187      *
    1188      * @link http://www.php.net/manual/en/memcached.delete.php
    1189      *
    1190      * @param   string      $key        The key under which to store the value.
    1191      * @param   string      $group      The group value appended to the $key.
    1192      * @param   int         $time       The amount of time the server will wait to delete the item in seconds.
    1193      * @param   string      $server_key The key identifying the server to store the value on.
    1194      * @param   bool        $by_key     True to store in internal cache by key; false to not store by key
    1195      * @return  bool                    Returns TRUE on success or FALSE on failure.
     1190     * Removes the item from the cache.
     1191     *
     1192     * Removes an item from memcached with identified by $key after $time seconds.
     1193     * The $time parameter allows an object to be queued for deletion without
     1194     * immediately deleting. Between the time that it is queued and the time it's deleted,
     1195     * add, replace, and get will fail, but set will succeed.
     1196     *
     1197     * @link https://www.php.net/manual/en/memcached.delete.php
     1198     *
     1199     * @param string $key        The key under which to store the value.
     1200     * @param string $group      The group value appended to the $key.
     1201     * @param int    $time       The amount of time the server will wait to delete the item in seconds.
     1202     * @param string $server_key The key identifying the server to store the value on.
     1203     * @param bool   $by_key     True to store in internal cache by key; false to not store by key.
     1204     * @return bool True on success, false on failure.
    11961205     */
    11971206    public function delete( $key, $group = 'default', $time = 0, $server_key = '', $by_key = false ) {
    11981207        $derived_key = $this->buildKey( $key, $group );
    11991208
    1200         // Remove from no_mc_groups array
     1209        // Remove from no_mc_groups array.
    12011210        if ( in_array( $group, $this->no_mc_groups, true ) ) {
    12021211            if ( isset( $this->cache[ $derived_key ] ) ) {
     
    12211230
    12221231    /**
    1223      * Remove the item from the cache by server key.
    1224      *
    1225      * Remove an item from memcached with identified by $key after $time seconds. The
    1226      * $time parameter allows an object to be queued for deletion without immediately
    1227      * deleting. Between the time that it is queued and the time it's deleted, add,
    1228      * replace, and get will fail, but set will succeed.
    1229      *
    1230      * @link http://www.php.net/manual/en/memcached.deletebykey.php
    1231      *
    1232      * @param   string      $server_key The key identifying the server to store the value on.
    1233      * @param   string      $key        The key under which to store the value.
    1234      * @param   string      $group      The group value appended to the $key.
    1235      * @param   int         $time       The amount of time the server will wait to delete the item in seconds.
    1236      * @return  bool                    Returns TRUE on success or FALSE on failure.
     1232     * Removes the item from the cache by server key.
     1233     *
     1234     * Removes an item from memcached with identified by $key after $time seconds.
     1235     * The $time parameter allows an object to be queued for deletion without
     1236     * immediately deleting. Between the time that it is queued and the time it's deleted,
     1237     * add, replace, and get will fail, but set will succeed.
     1238     *
     1239     * @link https://www.php.net/manual/en/memcached.deletebykey.php
     1240     *
     1241     * @param string $server_key The key identifying the server to store the value on.
     1242     * @param string $key        The key under which to store the value.
     1243     * @param string $group      The group value appended to the $key.
     1244     * @param int    $time       The amount of time the server will wait to delete the item in seconds.
     1245     * @return bool True on success, false on failure.
    12371246     */
    12381247    public function deleteByKey( $server_key, $key, $group = 'default', $time = 0 ) {
     
    12411250
    12421251    /**
    1243      * Fetch the next result.
    1244      *
    1245      * @link http://www.php.net/manual/en/memcached.fetch.php
    1246      *
    1247      * @return array|bool   Returns the next result or FALSE on failure.
     1252     * Fetches the next result.
     1253     *
     1254     * @link https://www.php.net/manual/en/memcached.fetch.php
     1255     *
     1256     * @return array|false The next result on success, false on failure.
    12481257     */
    12491258    public function fetch() {
     
    12521261
    12531262    /**
    1254      * Fetch all remaining results from the last request.
    1255      *
    1256      * @link http://www.php.net/manual/en/memcached.fetchall.php
    1257      *
    1258      * @return  array|bool          Returns the results or FALSE on failure.
     1263     * Fetches all remaining results from the last request.
     1264     *
     1265     * @link https://www.php.net/manual/en/memcached.fetchall.php
     1266     *
     1267     * @return array|false The results on success, false on failure.
    12591268     */
    12601269    public function fetchAll() {
     
    12631272
    12641273    /**
    1265      * Invalidate all items in the cache.
    1266      *
    1267      * @link http://www.php.net/manual/en/memcached.flush.php
    1268      *
    1269      * @param   int     $delay      Number of seconds to wait before invalidating the items.
    1270      * @return  bool                Returns TRUE on success or FALSE on failure.
     1274     * Invalidates all items in the cache.
     1275     *
     1276     * @link https://www.php.net/manual/en/memcached.flush.php
     1277     *
     1278     * @param int $delay Number of seconds to wait before invalidating the items.
     1279     * @return bool True on success, false on failure.
    12711280     */
    12721281    public function flush( $delay = 0 ) {
    12731282        $result = $this->m->flush( $delay );
    12741283
    1275         // Only reset the runtime cache if memcached was properly flushed
     1284        // Only reset the runtime cache if memcached was properly flushed.
    12761285        if ( Memcached::RES_SUCCESS === $this->getResultCode() ) {
    12771286            $this->cache = array();
     
    12821291
    12831292    /**
    1284      * Retrieve object from cache.
    1285      *
    1286      * Gets an object from cache based on $key and $group. In order to fully support the $cache_cb and $cas_token
    1287      * parameters, the runtime cache is ignored by this function if either of those values are set. If either of
    1288      * those values are set, the request is made directly to the memcached server for proper handling of the
    1289      * callback and/or token. Note that the $cas_token variable cannot be directly passed to the function. The
    1290      * variable need to be first defined with a non null value.
    1291      *
    1292      * If using the $cache_cb argument, the new value will always have an expiration of time of 0 (forever). This
    1293      * is a limitation of the Memcached PECL extension.
    1294      *
    1295      * @link http://www.php.net/manual/en/memcached.get.php
    1296      *
    1297      * @param   string          $key        The key under which to store the value.
    1298      * @param   string          $group      The group value appended to the $key.
    1299      * @param   bool            $force      Whether or not to force a cache invalidation.
    1300      * @param   null|bool       $found      Variable passed by reference to determine if the value was found or not.
    1301      * @param   string          $server_key The key identifying the server to store the value on.
    1302      * @param   bool            $by_key     True to store in internal cache by key; false to not store by key
    1303      * @param   null|callable   $cache_cb   Read-through caching callback.
    1304      * @param   null|float      $cas_token  The variable to store the CAS token in.
    1305      * @return  bool|mixed                  Cached object value.
     1293     * Retrieves object from cache.
     1294     *
     1295     * Gets an object from cache based on $key and $group. In order to fully support
     1296     * the $cache_cb and $cas_token parameters, the runtime cache is ignored by this function
     1297     * if either of those values are set. In that case, the request is made directly
     1298     * to the memcached server for proper handling of the callback and/or token.
     1299     * Note that the $cas_token variable cannot be directly passed to the function.
     1300     * The variable needs to be first defined with a non-null value.
     1301     *
     1302     * If using the $cache_cb argument, the new value will always have an expiration
     1303     * of time of 0 (forever). This is a limitation of the Memcached PECL extension.
     1304     *
     1305     * @link https://www.php.net/manual/en/memcached.get.php
     1306     *
     1307     * @param string        $key        The key under which to store the value.
     1308     * @param string        $group      The group value appended to the $key.
     1309     * @param bool          $force      Whether or not to force a cache invalidation.
     1310     * @param null|bool     $found      Variable passed by reference to determine if the value was found or not.
     1311     * @param string        $server_key The key identifying the server to store the value on.
     1312     * @param bool          $by_key     True to store in internal cache by key; false to not store by key.
     1313     * @param null|callable $cache_cb   Read-through caching callback.
     1314     * @param null|float    $cas_token  The variable to store the CAS token in.
     1315     * @return bool|mixed Cached object value.
    13061316     */
    13071317    public function get( $key, $group = 'default', $force = false, &$found = null, $server_key = '', $by_key = false, $cache_cb = null, &$cas_token = null ) {
    13081318        $derived_key = $this->buildKey( $key, $group );
    13091319
    1310         // Assume object is not found
     1320        // Assume object is not found.
    13111321        $found = false;
    13121322
    1313         // If either $cache_db, or $cas_token is set, must hit Memcached and bypass runtime cache
     1323        // If either $cache_db, or $cas_token is set, must hit Memcached and bypass runtime cache.
    13141324        if ( func_num_args() > 6 && ! in_array( $group, $this->no_mc_groups, true ) ) {
    13151325            if ( $by_key ) {
     
    13421352
    13431353    /**
    1344      * Retrieve object from cache from specified server.
    1345      *
    1346      * Gets an object from cache based on $key, $group and $server_key. In order to fully support the $cache_cb and $cas_token
    1347      * parameters, the runtime cache is ignored by this function if either of those values are set. If either of
    1348      * those values are set, the request is made directly to the memcached server for proper handling of the
    1349      * callback and/or token. Note that the $cas_token variable cannot be directly passed to the function. The
    1350      * variable need to be first defined with a non null value.
    1351      *
    1352      * If using the $cache_cb argument, the new value will always have an expiration of time of 0 (forever). This
    1353      * is a limitation of the Memcached PECL extension.
    1354      *
    1355      * @link http://www.php.net/manual/en/memcached.getbykey.php
    1356      *
    1357      * @param   string          $server_key The key identifying the server to store the value on.
    1358      * @param   string          $key        The key under which to store the value.
    1359      * @param   string          $group      The group value appended to the $key.
    1360      * @param   bool            $force      Whether or not to force a cache invalidation.
    1361      * @param   null|bool       $found      Variable passed by reference to determine if the value was found or not.
    1362      * @param   null|string     $cache_cb   Read-through caching callback.
    1363      * @param   null|float      $cas_token  The variable to store the CAS token in.
    1364      * @return  bool|mixed                  Cached object value.
     1354     * Retrieves object from cache from specified server.
     1355     *
     1356     * Gets an object from cache based on $key and $group, and $server_key. In order to fully support
     1357     * the $cache_cb and $cas_token parameters, the runtime cache is ignored by this function
     1358     * if either of those values are set. In that case, the request is made directly
     1359     * to the memcached server for proper handling of the callback and/or token.
     1360     * Note that the $cas_token variable cannot be directly passed to the function.
     1361     * The variable needs to be first defined with a non-null value.
     1362     *
     1363     * If using the $cache_cb argument, the new value will always have an expiration
     1364     * of time of 0 (forever). This is a limitation of the Memcached PECL extension.
     1365     *
     1366     * @link https://www.php.net/manual/en/memcached.getbykey.php
     1367     *
     1368     * @param string      $server_key The key identifying the server to store the value on.
     1369     * @param string      $key        The key under which to store the value.
     1370     * @param string      $group      The group value appended to the $key.
     1371     * @param bool        $force      Whether or not to force a cache invalidation.
     1372     * @param null|bool   $found      Variable passed by reference to determine if the value was found or not.
     1373     * @param null|string $cache_cb   Read-through caching callback.
     1374     * @param null|float  $cas_token  The variable to store the CAS token in.
     1375     * @return bool|mixed Cached object value.
    13651376     */
    13661377    public function getByKey( $server_key, $key, $group = 'default', $force = false, &$found = null, $cache_cb = null, &$cas_token = null ) {
     
    13771388
    13781389    /**
    1379      * Request multiple keys without blocking.
    1380      *
    1381      * @link http://www.php.net/manual/en/memcached.getdelayed.php
    1382      *
    1383      * @param   string|array    $keys       Array or string of key(s) to request.
    1384      * @param   string|array    $groups     Array or string of group(s) for the key(s). See buildKeys for more on how these are handled.
    1385      * @param   bool            $with_cas   Whether to request CAS token values also.
    1386      * @param   null            $value_cb   The result callback or NULL.
    1387      * @return  bool                        Returns TRUE on success or FALSE on failure.
     1390     * Requests multiple keys without blocking.
     1391     *
     1392     * @link https://www.php.net/manual/en/memcached.getdelayed.php
     1393     *
     1394     * @param string|array $keys     Array or string of key(s) to request.
     1395     * @param string|array $groups   Array or string of group(s) for the key(s).
     1396     *                               See buildKeys for more on how these are handled.
     1397     * @param bool         $with_cas Whether to request CAS token values also.
     1398     * @param null         $value_cb The result callback or null.
     1399     * @return bool True on success, false on failure.
    13881400     */
    13891401    public function getDelayed( $keys, $groups = 'default', $with_cas = false, $value_cb = null ) {
     
    13931405
    13941406    /**
    1395      * Request multiple keys without blocking from a specified server.
    1396      *
    1397      * @link http://www.php.net/manual/en/memcached.getdelayed.php
    1398      *
    1399      * @param   string          $server_key The key identifying the server to store the value on.
    1400      * @param   string|array    $keys       Array or string of key(s) to request.
    1401      * @param   string|array    $groups     Array or string of group(s) for the key(s). See buildKeys for more on how these are handled.
    1402      * @param   bool            $with_cas   Whether to request CAS token values also.
    1403      * @param   null            $value_cb   The result callback or NULL.
    1404      * @return  bool                        Returns TRUE on success or FALSE on failure.
     1407     * Requests multiple keys without blocking from a specified server.
     1408     *
     1409     * @link https://www.php.net/manual/en/memcached.getdelayed.php
     1410     *
     1411     * @param string       $server_key The key identifying the server to store the value on.
     1412     * @param string|array $keys       Array or string of key(s) to request.
     1413     * @param string|array $groups     Array or string of group(s) for the key(s).
     1414     *                                 See buildKeys for more on how these are handled.
     1415     * @param bool         $with_cas   Whether to request CAS token values also.
     1416     * @param null         $value_cb   The result callback or null.
     1417     * @return bool True on success, false on failure.
    14051418     */
    14061419    public function getDelayedByKey( $server_key, $keys, $groups = 'default', $with_cas = false, $value_cb = null ) {
     
    14141427     * See the buildKeys method definition to understand the $keys/$groups parameters.
    14151428     *
    1416      * @link http://www.php.net/manual/en/memcached.getmulti.php
    1417      *
    1418      * @param   array           $keys       Array of keys to retrieve.
    1419      * @param   string|array    $groups     If string, used for all keys. If arrays, corresponds with the $keys array.
    1420      * @param   string          $server_key The key identifying the server to store the value on.
    1421      * @param   null|array      $cas_tokens The variable to store the CAS tokens for the found items.
    1422      * @param   int             $flags      The flags for the get operation.
    1423      * @return  bool|array                  Returns the array of found items or FALSE on failure.
     1429     * @link https://www.php.net/manual/en/memcached.getmulti.php
     1430     *
     1431     * @param array        $keys       Array of keys to retrieve.
     1432     * @param string|array $groups     If string, used for all keys.
     1433     *                                 If arrays, corresponds with the $keys array.
     1434     * @param string       $server_key The key identifying the server to store the value on.
     1435     * @param null|array   $cas_tokens The variable to store the CAS tokens for the found items.
     1436     * @param int          $flags      The flags for the get operation.
     1437     * @return bool|array The array of found items on success, false on failure.
    14241438     */
    14251439    public function getMulti( $keys, $groups = 'default', $server_key = '', &$cas_tokens = null, $flags = null ) {
     
    14271441
    14281442        /**
    1429          * If either $cas_tokens, or $flags is set, must hit Memcached and bypass runtime cache. Note that
    1430          * this will purposely ignore no_mc_groups values as they cannot handle CAS tokens or the special
    1431          * flags; however, if the groups of groups contains a no_mc_group, this is bypassed.
     1443         * If either $cas_tokens, or $flags is set, must hit Memcached and bypass runtime cache.
     1444         * Note that this will purposely ignore no_mc_groups values as they cannot handle CAS tokens
     1445         * or the special flags; however, if the groups of groups contains a no_mc_group, this is bypassed.
    14321446         */
    14331447        if ( func_num_args() > 3 && ! $this->contains_no_mc_group( $groups ) ) {
     
    14411455            $need_to_get = array();
    14421456
    1443             // Pull out values from runtime cache, or mark for retrieval
     1457            // Pull out values from runtime cache, or mark for retrieval.
    14441458            foreach ( $derived_keys as $key ) {
    14451459                if ( isset( $this->cache[ $key ] ) ) {
     
    14501464            }
    14511465
    1452             // Get those keys not found in the runtime cache
     1466            // Get those keys not found in the runtime cache.
    14531467            if ( ! empty( $need_to_get ) ) {
    14541468                if ( ! empty( $server_key ) ) {
     
    14591473            }
    14601474
    1461             // Merge with values found in runtime cache
     1475            // Merge with values found in runtime cache.
    14621476            if ( isset( $result ) && Memcached::RES_SUCCESS === $this->getResultCode() ) {
    14631477                $values = array_merge( $values, $result );
    14641478            }
    14651479
    1466             // If order should be preserved, reorder now
     1480            // If order should be preserved, reorder now.
    14671481            if ( ! empty( $need_to_get ) && Memcached::GET_PRESERVE_ORDER === $flags ) {
    14681482                $ordered_values = array();
     
    14791493        }
    14801494
    1481         // Add the values to the runtime cache
     1495        // Add the values to the runtime cache.
    14821496        $this->cache = array_merge( $this->cache, $values );
    14831497
     
    14901504     * See the buildKeys method definition to understand the $keys/$groups parameters.
    14911505     *
    1492      * @link http://www.php.net/manual/en/memcached.getmultibykey.php
    1493      *
    1494      * @param   string          $server_key The key identifying the server to store the value on.
    1495      * @param   array           $keys       Array of keys to retrieve.
    1496      * @param   string|array    $groups     If string, used for all keys. If arrays, corresponds with the $keys array.
    1497      * @param   null|array      $cas_tokens The variable to store the CAS tokens for the found items.
    1498      * @param   int             $flags      The flags for the get operation.
    1499      * @return  bool|array                  Returns the array of found items or FALSE on failure.
     1506     * @link https://www.php.net/manual/en/memcached.getmultibykey.php
     1507     *
     1508     * @param string       $server_key The key identifying the server to store the value on.
     1509     * @param array        $keys       Array of keys to retrieve.
     1510     * @param string|array $groups     If string, used for all keys.
     1511     *                                 If arrays, corresponds with the $keys array.
     1512     * @param null|array   $cas_tokens The variable to store the CAS tokens for the found items.
     1513     * @param int          $flags      The flags for the get operation.
     1514     * @return bool|array The array of found items on success, false on failure.
    15001515     */
    15011516    public function getMultiByKey( $server_key, $keys, $groups = 'default', &$cas_tokens = null, $flags = null ) {
     
    15121527
    15131528    /**
    1514      * Retrieve a Memcached option value.
    1515      *
    1516      * @link http://www.php.net/manual/en/memcached.getoption.php
    1517      *
    1518      * @param   int         $option    One of the Memcached::OPT_* constants.
    1519      * @return  mixed                   Returns the value of the requested option, or FALSE on error.
     1529     * Retrieves a Memcached option value.
     1530     *
     1531     * @link https://www.php.net/manual/en/memcached.getoption.php
     1532     *
     1533     * @param int $option One of the Memcached::OPT_* constants.
     1534     * @return mixed The value of the requested option on success, false on failure.
    15201535     */
    15211536    public function getOption( $option ) {
     
    15241539
    15251540    /**
    1526      * Return the result code of the last option.
    1527      *
    1528      * @link http://www.php.net/manual/en/memcached.getresultcode.php
    1529      *
    1530      * @return  int    Result code of the last Memcached operation.
     1541     * Returns the result code of the last option.
     1542     *
     1543     * @link https://www.php.net/manual/en/memcached.getresultcode.php
     1544     *
     1545     * @return int Result code of the last Memcached operation.
    15311546     */
    15321547    public function getResultCode() {
     
    15371552     * Return the message describing the result of the last operation.
    15381553     *
    1539      * @link    http://www.php.net/manual/en/memcached.getresultmessage.php
    1540      *
    1541      * @return  string      Message describing the result of the last Memcached operation.
     1554     * @link https://www.php.net/manual/en/memcached.getresultmessage.php
     1555     *
     1556     * @return string Message describing the result of the last Memcached operation.
    15421557     */
    15431558    public function getResultMessage() {
     
    15461561
    15471562    /**
    1548      * Get server information by key.
    1549      *
    1550      * @link    http://www.php.net/manual/en/memcached.getserverbykey.php
    1551      *
    1552      * @param   string      $server_key    The key identifying the server to store the value on.
    1553      * @return  array                       Array with host, post, and weight on success, FALSE on failure.
     1563     * Gets server information by key.
     1564     *
     1565     * @link https://www.php.net/manual/en/memcached.getserverbykey.php
     1566     *
     1567     * @param string $server_key The key identifying the server to store the value on.
     1568     * @return array Array with host, post, and weight on success, false on failure.
    15541569     */
    15551570    public function getServerByKey( $server_key ) {
     
    15581573
    15591574    /**
    1560      * Get the list of servers in the pool.
    1561      *
    1562      * @link    http://www.php.net/manual/en/memcached.getserverlist.php
    1563      *
    1564      * @return  array      The list of all servers in the server pool.
     1575     * Gets the list of servers in the pool.
     1576     *
     1577     * @link https://www.php.net/manual/en/memcached.getserverlist.php
     1578     *
     1579     * @return array The list of all servers in the server pool.
    15651580     */
    15661581    public function getServerList() {
     
    15691584
    15701585    /**
    1571      * Get server pool statistics.
    1572      *
    1573      * @link    http://www.php.net/manual/en/memcached.getstats.php
    1574      *
    1575      * @return  array      Array of server statistics, one entry per server.
     1586     * Gets server pool statistics.
     1587     *
     1588     * @link https://www.php.net/manual/en/memcached.getstats.php
     1589     *
     1590     * @return array Array of server statistics, one entry per server.
    15761591     */
    15771592    public function getStats() {
     
    15801595
    15811596    /**
    1582      * Get server pool memcached version information.
    1583      *
    1584      * @link    http://www.php.net/manual/en/memcached.getversion.php
    1585      *
    1586      * @return  array      Array of server versions, one entry per server.
     1597     * Gets server pool memcached version information.
     1598     *
     1599     * @link https://www.php.net/manual/en/memcached.getversion.php
     1600     *
     1601     * @return array Array of server versions, one entry per server.
    15871602     */
    15881603    public function getVersion() {
     
    15911606
    15921607    /**
    1593      * Increment a numeric item's value.
    1594      *
    1595      * @link http://www.php.net/manual/en/memcached.increment.php
    1596      *
    1597      * @param   string      $key        The key under which to store the value.
    1598      * @param   int         $offset    The amount by which to increment the item's value.
    1599      * @param   string      $group      The group value appended to the $key.
    1600      * @return  int|bool                Returns item's new value on success or FALSE on failure.
     1608     * Increments a numeric item's value.
     1609     *
     1610     * @link https://www.php.net/manual/en/memcached.increment.php
     1611     *
     1612     * @param string $key    The key under which to store the value.
     1613     * @param int    $offset The amount by which to increment the item's value.
     1614     * @param string $group  The group value appended to the $key.
     1615     * @return int|bool Item's new value on success, false on failure.
    16011616     */
    16021617    public function increment( $key, $offset = 1, $group = 'default' ) {
    16031618        $derived_key = $this->buildKey( $key, $group );
    16041619
    1605         // Increment values in no_mc_groups
     1620        // Increment values in no_mc_groups.
    16061621        if ( in_array( $group, $this->no_mc_groups, true ) ) {
    16071622
    1608             // Only increment if the key already exists and the number is currently 0 or greater (mimics memcached behavior)
     1623            // Only increment if the key already exists and the number is currently 0 or greater (mimics memcached behavior).
    16091624            if ( isset( $this->cache[ $derived_key ] ) && $this->cache[ $derived_key ] >= 0 ) {
    16101625
    1611                 // If numeric, add; otherwise, consider it 0 and do nothing
     1626                // If numeric, add; otherwise, consider it 0 and do nothing.
    16121627                if ( is_numeric( $this->cache[ $derived_key ] ) ) {
    16131628                    $this->cache[ $derived_key ] += (int) $offset;
     
    16161631                }
    16171632
    1618                 // Returned value cannot be less than 0
     1633                // Returned value cannot be less than 0.
    16191634                if ( $this->cache[ $derived_key ] < 0 ) {
    16201635                    $this->cache[ $derived_key ] = 0;
     
    16371652
    16381653    /**
    1639      * Synonymous with $this->incr.
    1640      *
    1641      * Certain plugins expect an "incr" method on the $wp_object_cache object (e.g., Batcache). Since the original
    1642      * version of this library matched names to the memcached methods, the "incr" method was missing. Adding this
    1643      * method restores compatibility with plugins expecting an "incr" method.
    1644      *
    1645      * @param   string      $key        The key under which to store the value.
    1646      * @param   int         $offset     The amount by which to increment the item's value.
    1647      * @param   string      $group      The group value appended to the $key.
    1648      * @return  int|bool                Returns item's new value on success or FALSE on failure.
     1654     * Alias for $this->incr().
     1655     *
     1656     * Certain plugins expect an "incr" method on the $wp_object_cache object (e.g., Batcache).
     1657     * Since the original version of this library matched names to the memcached methods,
     1658     * the "incr" method was missing. Adding this method restores compatibility with plugins
     1659     * expecting an "incr" method.
     1660     *
     1661     * @param string $key    The key under which to store the value.
     1662     * @param int    $offset The amount by which to increment the item's value.
     1663     * @param string $group  The group value appended to the $key.
     1664     * @return int|bool Item's new value on success, false on failure.
    16491665     */
    16501666    public function incr( $key, $offset = 1, $group = 'default' ) {
     
    16531669
    16541670    /**
    1655      * Prepend data to an existing item.
     1671     * Prepends data to an existing item.
    16561672     *
    16571673     * This method should throw an error if it is used with compressed data. This is an expected behavior.
    1658      * Memcached casts the value to be prepended to the initial value to the type of the initial value. Be
    1659      * careful as this leads to unexpected behavior at times. For instance, prepending (float) 45.23 to
    1660      * (int) 23 will result in 45, because the value is first combined (45.2323) then cast to "integer"
     1674     * Memcached casts the value to be prepended to the initial value to the type of the initial value.
     1675     * Be careful as this leads to unexpected behavior at times. For instance, prepending (float) 45.23
     1676     * to (int) 23 will result in 45, because the value is first combined (45.2323) then cast to "integer"
    16611677     * (the original value), which will be (int) 45. Due to how memcached treats types, the behavior has been
    1662      * mimicked in the internal cache to produce similar results and improve consistency. It is recommend
     1678     * mimicked in the internal cache to produce similar results and improve consistency. It is recommended
    16631679     * that prepends only occur with data of the same type.
    16641680     *
    1665      * @link    http://www.php.net/manual/en/memcached.prepend.php
    1666      *
    1667      * @param   string    $key          The key under which to store the value.
    1668      * @param   string    $value        Must be string as prepending mixed values is not well-defined.
    1669      * @param   string    $group        The group value prepended to the $key.
    1670      * @param   string    $server_key  The key identifying the server to store the value on.
    1671      * @param   bool      $by_key       True to store in internal cache by key; false to not store by key
    1672      * @return  bool                    Returns TRUE on success or FALSE on failure.
     1681     * @link https://www.php.net/manual/en/memcached.prepend.php
     1682     *
     1683     * @param string $key        The key under which to store the value.
     1684     * @param string $value      Must be string as prepending mixed values is not well-defined.
     1685     * @param string $group      The group value prepended to the $key.
     1686     * @param string $server_key The key identifying the server to store the value on.
     1687     * @param bool   $by_key     True to store in internal cache by key; false to not store by key.
     1688     * @return bool True on success, false on failure.
    16731689     */
    16741690    public function prepend( $key, $value, $group = 'default', $server_key = '', $by_key = false ) {
     
    16791695        $derived_key = $this->buildKey( $key, $group );
    16801696
    1681         // If group is a non-Memcached group, prepend to runtime cache value, not Memcached
     1697        // If group is a non-Memcached group, prepend to runtime cache value, not Memcached.
    16821698        if ( in_array( $group, $this->no_mc_groups, true ) ) {
    16831699            if ( ! isset( $this->cache[ $derived_key ] ) ) {
     
    16901706        }
    16911707
    1692         // Append to Memcached value
     1708        // Append to Memcached value.
    16931709        if ( $by_key ) {
    16941710            $result = $this->m->prependByKey( $server_key, $derived_key, $value );
     
    16971713        }
    16981714
    1699         // Store in runtime cache if add was successful
     1715        // Store in runtime cache if add was successful.
    17001716        if ( Memcached::RES_SUCCESS === $this->getResultCode() ) {
    17011717            $combined = $this->combine_values( $this->cache[ $derived_key ], $value, 'pre' );
     
    17071723
    17081724    /**
    1709      * Append data to an existing item by server key.
     1725     * Appends data to an existing item by server key.
    17101726     *
    17111727     * This method should throw an error if it is used with compressed data. This is an expected behavior.
    1712      * Memcached casts the value to be prepended to the initial value to the type of the initial value. Be
    1713      * careful as this leads to unexpected behavior at times. For instance, prepending (float) 45.23 to
    1714      * (int) 23 will result in 45, because the value is first combined (45.2323) then cast to "integer"
     1728     * Memcached casts the value to be prepended to the initial value to the type of the initial value.
     1729     * Be careful as this leads to unexpected behavior at times. For instance, prepending (float) 45.23
     1730     * to (int) 23 will result in 45, because the value is first combined (45.2323) then cast to "integer"
    17151731     * (the original value), which will be (int) 45. Due to how memcached treats types, the behavior has been
    1716      * mimicked in the internal cache to produce similar results and improve consistency. It is recommend
     1732     * mimicked in the internal cache to produce similar results and improve consistency. It is recommended
    17171733     * that prepends only occur with data of the same type.
    17181734     *
    1719      * @link    http://www.php.net/manual/en/memcached.prependbykey.php
    1720      *
    1721      * @param   string    $server_key  The key identifying the server to store the value on.
    1722      * @param   string    $key          The key under which to store the value.
    1723      * @param   string    $value        Must be string as prepending mixed values is not well-defined.
    1724      * @param   string    $group        The group value prepended to the $key.
    1725      * @return  bool                    Returns TRUE on success or FALSE on failure.
     1735     * @link https://www.php.net/manual/en/memcached.prependbykey.php
     1736     *
     1737     * @param string $server_key The key identifying the server to store the value on.
     1738     * @param string $key        The key under which to store the value.
     1739     * @param string $value      Must be string as prepending mixed values is not well-defined.
     1740     * @param string $group      The group value prepended to the $key.
     1741     * @return bool True on success, false on failure.
    17261742     */
    17271743    public function prependByKey( $server_key, $key, $value, $group = 'default' ) {
     
    17321748     * Replaces a value in cache.
    17331749     *
    1734      * This method is similar to "add"; however, is does not successfully set a value if
    1735      * the object's key is not already set in cache.
    1736      *
    1737      * @link    http://www.php.net/manual/en/memcached.replace.php
    1738      *
    1739      * @param   string      $server_key    The key identifying the server to store the value on.
    1740      * @param   string      $key            The key under which to store the value.
    1741      * @param   mixed       $value          The value to store.
    1742      * @param   string      $group          The group value appended to the $key.
    1743      * @param   bool        $by_key         True to store in internal cache by key; false to not store by key
    1744      * @param   int         $expiration    The expiration time, defaults to 0.
    1745      * @return  bool                        Returns TRUE on success or FALSE on failure.
     1750     * This method is similar to "add"; however, is does not successfully set a value
     1751     * if the object's key is not already set in cache.
     1752     *
     1753     * @link https://www.php.net/manual/en/memcached.replace.php
     1754     *
     1755     * @param string $server_key The key identifying the server to store the value on.
     1756     * @param string $key        The key under which to store the value.
     1757     * @param mixed  $value      The value to store.
     1758     * @param string $group      The group value appended to the $key.
     1759     * @param bool   $by_key     True to store in internal cache by key; false to not store by key.
     1760     * @param int    $expiration The expiration time, defaults to 0.
     1761     * @return bool True on success, false on failure.
    17461762     */
    17471763    public function replace( $key, $value, $group = 'default', $expiration = 0, $server_key = '', $by_key = false ) {
     
    17491765        $expiration  = $this->sanitize_expiration( $expiration );
    17501766
    1751         // If group is a non-Memcached group, save to runtime cache, not Memcached
     1767        // If group is a non-Memcached group, save to runtime cache, not Memcached.
    17521768        if ( in_array( $group, $this->no_mc_groups, true ) ) {
    17531769
    1754             // Replace won't save unless the key already exists; mimic this behavior here
     1770            // Replace won't save unless the key already exists; mimic this behavior here.
    17551771            if ( ! isset( $this->cache[ $derived_key ] ) ) {
    17561772                return false;
     
    17611777        }
    17621778
    1763         // Save to Memcached
     1779        // Save to Memcached.
    17641780        if ( $by_key ) {
    17651781            $result = $this->m->replaceByKey( $server_key, $derived_key, $value, $expiration );
     
    17681784        }
    17691785
    1770         // Store in runtime cache if add was successful
     1786        // Store in runtime cache if add was successful.
    17711787        if ( Memcached::RES_SUCCESS === $this->getResultCode() ) {
    17721788            $this->add_to_internal_cache( $derived_key, $value );
     
    17791795     * Replaces a value in cache on a specific server.
    17801796     *
    1781      * This method is similar to "addByKey"; however, is does not successfully set a value if
    1782      * the object's key is not already set in cache.
    1783      *
    1784      * @link    http://www.php.net/manual/en/memcached.addbykey.php
    1785      *
    1786      * @param   string      $server_key    The key identifying the server to store the value on.
    1787      * @param   string      $key            The key under which to store the value.
    1788      * @param   mixed       $value          The value to store.
    1789      * @param   string      $group          The group value appended to the $key.
    1790      * @param   int         $expiration    The expiration time, defaults to 0.
    1791      * @return  bool                        Returns TRUE on success or FALSE on failure.
     1797     * This method is similar to "addByKey"; however, is does not successfully set a value
     1798     * if the object's key is not already set in cache.
     1799     *
     1800     * @link https://www.php.net/manual/en/memcached.addbykey.php
     1801     *
     1802     * @param string $server_key The key identifying the server to store the value on.
     1803     * @param string $key        The key under which to store the value.
     1804     * @param mixed  $value      The value to store.
     1805     * @param string $group      The group value appended to the $key.
     1806     * @param int    $expiration The expiration time, defaults to 0.
     1807     * @return bool True on success, false on failure.
    17921808     */
    17931809    public function replaceByKey( $server_key, $key, $value, $group = 'default', $expiration = 0 ) {
     
    18001816     * The value is set whether or not this key already exists in memcached.
    18011817     *
    1802      * @link http://www.php.net/manual/en/memcached.set.php
    1803      *
    1804      * @param   string      $key        The key under which to store the value.
    1805      * @param   mixed       $value      The value to store.
    1806      * @param   string      $group      The group value appended to the $key.
    1807      * @param   int         $expiration The expiration time, defaults to 0.
    1808      * @param   string      $server_key The key identifying the server to store the value on.
    1809      * @param   bool        $by_key     True to store in internal cache by key; false to not store by key
    1810      * @return  bool                    Returns TRUE on success or FALSE on failure.
     1818     * @link https://www.php.net/manual/en/memcached.set.php
     1819     *
     1820     * @param string $key        The key under which to store the value.
     1821     * @param mixed  $value      The value to store.
     1822     * @param string $group      The group value appended to the $key.
     1823     * @param int    $expiration The expiration time, defaults to 0.
     1824     * @param string $server_key The key identifying the server to store the value on.
     1825     * @param bool   $by_key     True to store in internal cache by key; false to not store by key.
     1826     * @return bool True on success, false on failure.
    18111827     */
    18121828    public function set( $key, $value, $group = 'default', $expiration = 0, $server_key = '', $by_key = false ) {
     
    18141830        $expiration  = $this->sanitize_expiration( $expiration );
    18151831
    1816         // If group is a non-Memcached group, save to runtime cache, not Memcached
     1832        // If group is a non-Memcached group, save to runtime cache, not Memcached.
    18171833        if ( in_array( $group, $this->no_mc_groups, true ) ) {
    18181834            $this->add_to_internal_cache( $derived_key, $value );
     
    18201836        }
    18211837
    1822         // Save to Memcached
     1838        // Save to Memcached.
    18231839        if ( $by_key ) {
    18241840            $result = $this->m->setByKey( $server_key, $derived_key, $value, $expiration );
     
    18271843        }
    18281844
    1829         // Store in runtime cache if add was successful
     1845        // Store in runtime cache if add was successful.
    18301846        if ( Memcached::RES_SUCCESS === $this->getResultCode() ) {
    18311847            $this->add_to_internal_cache( $derived_key, $value );
     
    18401856     * The value is set whether or not this key already exists in memcached.
    18411857     *
    1842      * @link    http://www.php.net/manual/en/memcached.setbykey.php
    1843      *
    1844      * @param   string      $server_key    The key identifying the server to store the value on.
    1845      * @param   string      $key            The key under which to store the value.
    1846      * @param   mixed       $value          The value to store.
    1847      * @param   string      $group          The group value appended to the $key.
    1848      * @param   int         $expiration    The expiration time, defaults to 0.
    1849      * @return  bool                        Returns TRUE on success or FALSE on failure.
     1858     * @link https://www.php.net/manual/en/memcached.setbykey.php
     1859     *
     1860     * @param string $server_key The key identifying the server to store the value on.
     1861     * @param string $key        The key under which to store the value.
     1862     * @param mixed  $value      The value to store.
     1863     * @param string $group      The group value appended to the $key.
     1864     * @param int    $expiration The expiration time, defaults to 0.
     1865     * @return bool True on success, false on failure.
    18501866     */
    18511867    public function setByKey( $server_key, $key, $value, $group = 'default', $expiration = 0 ) {
     
    18541870
    18551871    /**
    1856      * Set multiple values to cache at once.
     1872     * Sets multiple values to cache at once.
    18571873     *
    18581874     * By sending an array of $items to this function, all values are saved at once to
     
    18621878     * final key for the object.
    18631879     *
    1864      * @link    http://www.php.net/manual/en/memcached.setmulti.php
    1865      *
    1866      * @param   array           $items          An array of key/value pairs to store on the server.
    1867      * @param   string|array    $groups         Group(s) to merge with key(s) in $items.
    1868      * @param   int             $expiration    The expiration time, defaults to 0.
    1869      * @param   string          $server_key    The key identifying the server to store the value on.
    1870      * @param   bool            $by_key         True to store in internal cache by key; false to not store by key
    1871      * @return  bool                            Returns TRUE on success or FALSE on failure.
     1880     * @link https://www.php.net/manual/en/memcached.setmulti.php
     1881     *
     1882     * @param array        $items      An array of key/value pairs to store on the server.
     1883     * @param string|array $groups     Group(s) to merge with key(s) in $items.
     1884     * @param int          $expiration The expiration time, defaults to 0.
     1885     * @param string       $server_key The key identifying the server to store the value on.
     1886     * @param bool         $by_key     True to store in internal cache by key; false to not store by key.
     1887     * @return bool True on success, false on failure.
    18721888     */
    18731889    public function setMulti( $items, $groups = 'default', $expiration = 0, $server_key = '', $by_key = false ) {
    1874         // Build final keys and replace $items keys with the new keys
     1890        // Build final keys and replace $items keys with the new keys.
    18751891        $derived_keys  = $this->buildKeys( array_keys( $items ), $groups );
    18761892        $expiration    = $this->sanitize_expiration( $expiration );
    18771893        $derived_items = array_combine( $derived_keys, $items );
    18781894
    1879         // Do not add to memcached if in no_mc_groups
     1895        // Do not add to memcached if in no_mc_groups.
    18801896        foreach ( $derived_items as $derived_key => $value ) {
    18811897
    1882             // Get the individual item's group
     1898            // Get the individual item's group.
    18831899            $key_pieces = explode( ':', $derived_key );
    18841900
    1885             // If group is a non-Memcached group, save to runtime cache, not Memcached
     1901            // If group is a non-Memcached group, save to runtime cache, not Memcached.
    18861902            if ( in_array( $key_pieces[1], $this->no_mc_groups, true ) ) {
    18871903                $this->add_to_internal_cache( $derived_key, $value );
     
    18901906        }
    18911907
    1892         // Save to memcached
     1908        // Save to memcached.
    18931909        if ( $by_key ) {
    18941910            $result = $this->m->setMultiByKey( $server_key, $derived_items, $expiration );
     
    18971913        }
    18981914
    1899         // Store in runtime cache if add was successful
     1915        // Store in runtime cache if add was successful.
    19001916        if ( Memcached::RES_SUCCESS === $this->getResultCode() ) {
    19011917            $this->cache = array_merge( $this->cache, $derived_items );
     
    19061922
    19071923    /**
    1908      * Set multiple values to cache at once on specified server.
     1924     * Sets multiple values to cache at once on specified server.
    19091925     *
    19101926     * By sending an array of $items to this function, all values are saved at once to
     
    19141930     * final key for the object.
    19151931     *
    1916      * @link    http://www.php.net/manual/en/memcached.setmultibykey.php
    1917      *
    1918      * @param   string          $server_key     The key identifying the server to store the value on.
    1919      * @param   array           $items          An array of key/value pairs to store on the server.
    1920      * @param   string|array    $groups         Group(s) to merge with key(s) in $items.
    1921      * @param   int             $expiration     The expiration time, defaults to 0.
    1922      * @return  bool                            Returns TRUE on success or FALSE on failure.
     1932     * @link https://www.php.net/manual/en/memcached.setmultibykey.php
     1933     *
     1934     * @param string       $server_key  The key identifying the server to store the value on.
     1935     * @param array        $items       An array of key/value pairs to store on the server.
     1936     * @param string|array $groups      Group(s) to merge with key(s) in $items.
     1937     * @param int          $expiration  The expiration time, defaults to 0.
     1938     * @return bool True on success, false on failure.
    19231939     */
    19241940    public function setMultiByKey( $server_key, $items, $groups = 'default', $expiration = 0 ) {
     
    19271943
    19281944    /**
    1929      * Set a Memcached option.
    1930      *
    1931      * @link    http://www.php.net/manual/en/memcached.setoption.php
    1932      *
    1933      * @param   int         $option    Option name.
    1934      * @param   mixed       $value      Option value.
    1935      * @return  bool                Returns TRUE on success or FALSE on failure.
     1945     * Sets a Memcached option.
     1946     *
     1947     * @link https://www.php.net/manual/en/memcached.setoption.php
     1948     *
     1949     * @param int   $option Option name.
     1950     * @param mixed $value  Option value.
     1951     * @return bool True on success, false on failure.
    19361952     */
    19371953    public function setOption( $option, $value ) {
     
    19421958     * Builds a key for the cached object using the blog_id, key, and group values.
    19431959     *
    1944      * @author  Ryan Boren   This function is inspired by the original WP Memcached Object cache.
    1945      * @link    http://wordpress.org/extend/plugins/memcached/
    1946      *
    1947      * @param   string      $key        The key under which to store the value.
    1948      * @param   string      $group      The group value appended to the $key.
    1949      * @return  string
     1960     * This function is inspired by the original WP Memcached Object cache.
     1961     *
     1962     * @author Ryan Boren
     1963     * @link http://wordpress.org/extend/plugins/memcached/
     1964     *
     1965     * @param string $key   The key under which to store the value.
     1966     * @param string $group The group value appended to the $key.
     1967     * @return string
    19501968     */
    19511969    public function buildKey( $key, $group = 'default' ) {
     
    19751993     * that call memcached with an array of keys.
    19761994     *
    1977      * @param   string|array    $keys       Key(s) to merge with group(s).
    1978      * @param   string|array    $groups    Group(s) to merge with key(s).
    1979      * @return  array                      Array that combines keys and groups into a single set of memcached keys.
     1995     * @param string|array $keys   Key(s) to merge with group(s).
     1996     * @param string|array $groups Group(s) to merge with key(s).
     1997     * @return array Array that combines keys and groups into a single set of memcached keys.
    19801998     */
    19811999    public function buildKeys( $keys, $groups = 'default' ) {
    19822000        $derived_keys = array();
    19832001
    1984         // If strings sent, convert to arrays for proper handling
     2002        // If strings sent, convert to arrays for proper handling.
    19852003        if ( ! is_array( $groups ) ) {
    19862004            $groups = (array) $groups;
     
    19912009        }
    19922010
    1993         // If we have equal numbers of keys and groups, merge $keys[n] and $group[n]
     2011        // If we have equal numbers of keys and groups, merge $keys[n] and $group[n].
    19942012        if ( count( $keys ) === count( $groups ) ) {
    19952013            for ( $i = 0; $i < count( $keys ); $i++ ) {
     
    19972015            }
    19982016
    1999             // If more keys are received than groups, merge $keys[n] and $group[n] until no more group are left; remaining groups are 'default'
     2017            // If more keys are received than groups, merge $keys[n] and $group[n]
     2018            // until no more groups are left; remaining groups are 'default'.
    20002019        } elseif ( count( $keys ) > count( $groups ) ) {
    20012020            for ( $i = 0; $i < count( $keys ); $i++ ) {
     
    20142033
    20152034    /**
    2016      * Ensure that a proper expiration time is set.
    2017      *
    2018      * Memcached treats any value over 30 days as a timestamp. If a developer sets the expiration for greater than 30
    2019      * days or less than the current timestamp, the timestamp is in the past and the value isn't cached. This function
    2020      * detects values in that range and corrects them.
    2021      *
    2022      * @param  string|int    $expiration    The dirty expiration time.
    2023      * @return string|int                   The sanitized expiration time.
     2035     * Ensures that a proper expiration time is set.
     2036     *
     2037     * Memcached treats any value over 30 days as a timestamp. If a developer sets the expiration
     2038     * for greater than 30 days or less than the current timestamp, the timestamp is in the past
     2039     * and the value isn't cached. This function detects values in that range and corrects them.
     2040     *
     2041     * @param string|int $expiration The dirty expiration time.
     2042     * @return string|int The sanitized expiration time.
    20242043     */
    20252044    public function sanitize_expiration( $expiration ) {
     
    20382057     * will dictate the type of the combined value.
    20392058     *
    2040      * @param   mixed       $original   Original value that dictates the combined type.
    2041      * @param   mixed       $pended     Value to combine with original value.
    2042      * @param   string      $direction Either 'pre' or 'app'.
    2043      * @return  mixed                  Combined value casted to the type of the first value.
     2059     * @param mixed  $original  Original value that dictates the combined type.
     2060     * @param mixed  $pended    Value to combine with original value.
     2061     * @param string $direction Either 'pre' or 'app'.
     2062     * @return mixed Combined value casted to the type of the first value.
    20442063     */
    20452064    public function combine_values( $original, $pended, $direction ) {
    20462065        $type = gettype( $original );
    20472066
    2048         // Combine the values based on direction of the "pend"
     2067        // Combine the values based on direction of the "pend".
    20492068        if ( 'pre' === $direction ) {
    20502069            $combined = $pended . $original;
     
    20532072        }
    20542073
    2055         // Cast type of combined value
     2074        // Cast type of combined value.
    20562075        settype( $combined, $type );
    20572076
     
    20622081     * Simple wrapper for saving object to the internal cache.
    20632082     *
    2064      * @param   string      $derived_key    Key to save value under.
    2065      * @param   mixed       $value          Object value.
     2083     * @param string $derived_key Key to save value under.
     2084     * @param mixed  $value       Object value.
    20662085     */
    20672086    public function add_to_internal_cache( $derived_key, $value ) {
     
    20762095     * Determines if a no_mc_group exists in a group of groups.
    20772096     *
    2078      * @param   mixed   $groups    The groups to search.
    2079      * @return  bool                True if a no_mc_group is present; false if a no_mc_group is not present.
     2097     * @param mixed $groups The groups to search.
     2098     * @return bool True if a no_mc_group is present; false if a no_mc_group is not present.
    20802099     */
    20812100    public function contains_no_mc_group( $groups ) {
     
    20982117
    20992118    /**
    2100      * Add global groups.
    2101      *
    2102      * @author  Ryan Boren   This function comes straight from the original WP Memcached Object cache
    2103      * @link    http://wordpress.org/extend/plugins/memcached/
    2104      *
    2105      * @param   array       $groups     Array of groups.
    2106      * @return  void
     2119     * Adds global groups.
     2120     *
     2121     * This function comes straight from the original WP Memcached Object cache.
     2122     *
     2123     * @author Ryan Boren
     2124     * @link http://wordpress.org/extend/plugins/memcached/
     2125     *
     2126     * @param array $groups Array of groups.
     2127     * @return void
    21072128     */
    21082129    public function add_global_groups( $groups ) {
     
    21162137
    21172138    /**
    2118      * Add non-persistent groups.
    2119      *
    2120      * @author  Ryan Boren   This function comes straight from the original WP Memcached Object cache
    2121      * @link    http://wordpress.org/extend/plugins/memcached/
    2122      *
    2123      * @param   array       $groups     Array of groups.
    2124      * @return  void
     2139     * Adds non-persistent groups.
     2140     *
     2141     * This function comes straight from the original WP Memcached Object cache.
     2142     *
     2143     * @author Ryan Boren
     2144     * @link http://wordpress.org/extend/plugins/memcached/
     2145     *
     2146     * @param array $groups Array of groups.
     2147     * @return void
    21252148     */
    21262149    public function add_non_persistent_groups( $groups ) {
     
    21342157
    21352158    /**
    2136      * Get a value specifically from the internal, run-time cache, not memcached.
    2137      *
    2138      * @param   int|string  $key        Key value.
    2139      * @param   int|string  $group      Group that the value belongs to.
    2140      * @return  bool|mixed              Value on success; false on failure.
     2159     * Gets a value specifically from the internal, run-time cache, not memcached.
     2160     *
     2161     * @param int|string $key   Key value.
     2162     * @param int|string $group Group that the value belongs to.
     2163     * @return bool|mixed Value on success, false on failure.
    21412164     */
    21422165    public function get_from_runtime_cache( $key, $group ) {
     
    21512174
    21522175    /**
    2153      * Switch blog prefix, which changes the cache that is accessed.
    2154      *
    2155      * @param  int     $blog_id    Blog to switch to.
     2176     * Switches blog prefix, which changes the cache that is accessed.
     2177     *
     2178     * @param int $blog_id Blog to switch to.
    21562179     * @return void
    21572180     */
Note: See TracChangeset for help on using the changeset viewer.