WordPress.org

Make WordPress Core

Ticket #11621: 11621.patch

File 11621.patch, 4.5 KB (added by hakre, 8 years ago)
  • wp-includes/cache.php

    ### Eclipse Workspace Patch 1.0
    #P wordpress-trunk
     
    99 */
    1010
    1111/**
     12 * global variable storing the object cache class.
     13 *
     14 * is initialized as null and will be set later
     15 * @see wp_cache_init()
     16 * 
     17 * @global WP_Object_Cache $GLOBALS['wp_object_cache']
     18 * @name $wp_object_cache
     19 */
     20$GLOBALS['wp_object_cache'] = null;
     21
     22/**
    1223 * Adds data to the cache, if the cache key doesn't aleady exist.
    1324 *
    1425 * @since 2.0.0
    15  * @uses $wp_object_cache Object Cache Class
    16  * @see WP_Object_Cache::add()
     26 * @global WP_Object_Cache WordPress Object Cache
    1727 *
    1828 * @param int|string $key The cache ID to use for retrieval later
    1929 * @param mixed $data The data to add to the cache store
     
    2232 * @return unknown
    2333 */
    2434function wp_cache_add($key, $data, $flag = '', $expire = 0) {
     35        /* @var $wp_object_cache WP_Object_Cache */
    2536        global $wp_object_cache;
    2637
    2738        return $wp_object_cache->add($key, $data, $flag, $expire);
     
    4758 * Removes the cache contents matching ID and flag.
    4859 *
    4960 * @since 2.0.0
    50  * @uses $wp_object_cache Object Cache Class
    51  * @see WP_Object_Cache::delete()
     61 * @global WP_Object_Cache WordPress Object Cache
    5262 *
    5363 * @param int|string $id What the contents in the cache are called
    5464 * @param string $flag Where the cache contents are grouped
    5565 * @return bool True on successful removal, false on failure
    5666 */
    5767function wp_cache_delete($id, $flag = '') {
     68        /* @var $wp_object_cache WP_Object_Cache */
    5869        global $wp_object_cache;
    5970
    6071        return $wp_object_cache->delete($id, $flag);
     
    6475 * Removes all cache items.
    6576 *
    6677 * @since 2.0.0
    67  * @uses $wp_object_cache Object Cache Class
    68  * @see WP_Object_Cache::flush()
     78 * @global WP_Object_Cache WordPress Object Cache
    6979 *
    70  * @return bool Always returns true
     80 * @return bool true
    7181 */
    7282function wp_cache_flush() {
     83        /* @var $wp_object_cache WP_Object_Cache */
    7384        global $wp_object_cache;
    7485
    7586        return $wp_object_cache->flush();
     
    7990 * Retrieves the cache contents from the cache by ID and flag.
    8091 *
    8192 * @since 2.0.0
    82  * @uses $wp_object_cache Object Cache Class
    83  * @see WP_Object_Cache::get()
     93 * @global WP_Object_Cache WordPress Object Cache
    8494 *
    8595 * @param int|string $id What the contents in the cache are called
    8696 * @param string $flag Where the cache contents are grouped
    8797 * @return bool|mixed False on failure to retrieve contents or the cache
    8898 *              contents on success
    89  */
     99  */
    90100function wp_cache_get($id, $flag = '') {
     101        /* @var $wp_object_cache WP_Object_Cache */
    91102        global $wp_object_cache;
    92103
    93104        return $wp_object_cache->get($id, $flag);
     
    97108 * Sets up Object Cache Global and assigns it.
    98109 *
    99110 * @since 2.0.0
    100  * @global WP_Object_Cache $wp_object_cache WordPress Object Cache
    101111 */
    102112function wp_cache_init() {
    103113        $GLOBALS['wp_object_cache'] =& new WP_Object_Cache();
     
    107117 * Replaces the contents of the cache with new data.
    108118 *
    109119 * @since 2.0.0
    110  * @uses $wp_object_cache Object Cache Class
    111  * @see WP_Object_Cache::replace()
     120 * @global WP_Object_Cache WordPress Object Cache
    112121 *
    113122 * @param int|string $id What to call the contents in the cache
    114123 * @param mixed $data The contents to store in the cache
     
    117126 * @return bool False if cache ID and group already exists, true on success
    118127 */
    119128function wp_cache_replace($key, $data, $flag = '', $expire = 0) {
     129        /* @var $wp_object_cache WP_Object_Cache */
    120130        global $wp_object_cache;
    121131
    122132        return $wp_object_cache->replace($key, $data, $flag, $expire);
     
    126136 * Saves the data to the cache.
    127137 *
    128138 * @since 2.0
    129  * @uses $wp_object_cache Object Cache Class
    130  * @see WP_Object_Cache::set()
     139 * @global WP_Object_Cache WordPress Object Cache
    131140 *
    132141 * @param int|string $id What to call the contents in the cache
    133142 * @param mixed $data The contents to store in the cache
     
    136145 * @return bool False if cache ID and group already exists, true on success
    137146 */
    138147function wp_cache_set($key, $data, $flag = '', $expire = 0) {
     148        /* @var $wp_object_cache WP_Object_Cache */     
    139149        global $wp_object_cache;
    140150
    141151        return $wp_object_cache->set($key, $data, $flag, $expire);
     
    279289         *
    280290         * @since 2.0.0
    281291         *
    282          * @return bool Always returns true
     292         * @return bool true
    283293         */
    284294        function flush() {
    285295                $this->cache = array ();
     
    449459                return true;
    450460        }
    451461}
    452 ?>
     462
     463?>
     464 No newline at end of file