Skip to:
Content

BuddyPress.org

Changeset 9333


Ignore:
Timestamp:
01/09/2015 07:40:34 PM (6 years ago)
Author:
johnjamesjacoby
Message:

Remove bp_cache_ functions introduced in r9313; bumping to 2.3. See #5733.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-core/bp-core-cache.php

    r9317 r9333  
    2525        return prune_super_cache( $cache_path, true );
    2626    }
    27 }
    28 
    29 /**
    30  * Get the root blog cache key, used by our wrapper functions to differentiate
    31  * which blog to store our cached data in.
    32  *
    33  * @since BuddyPress (2.2.0)
    34  *
    35  * @param  string $key
    36  * @return string
    37  */
    38 function bp_get_root_blog_cache_key( $key = '' ) {
    39     $root_blog_id = bp_get_root_blog_id();
    40     return "{$root_blog_id}:{$key}";
    41 }
    42 
    43 /**
    44  * Retrieves the cache contents from the cache by key and group.
    45  *
    46  * @since BuddyPress (2.2.0)
    47  *
    48  * @uses wp_cache_get()
    49  * @see WP_Object_Cache::get()
    50  *
    51  * @param  int|string $key   What the contents in the cache are called
    52  * @param  string     $group Where the cache contents are grouped
    53  * @param  bool       $force Whether to force an update of the local cache from
    54  *                           the persistent cache (default is false)
    55  * @param  bool       $found Whether key was found in the cache. Disambiguates a
    56  *                           return of false, a storable value.
    57  * @return bool|mixed        False on failure to retrieve contents or the cache
    58  *                           contents on success
    59  */
    60 function bp_cache_get( $key, $group = '', $force = false, &$found = null ) {
    61     $cache_key = bp_get_root_blog_cache_key( $key );
    62 
    63     return wp_cache_get( $cache_key, $group, $force, $found );
    64 }
    65 
    66 /**
    67  * Saves the data to the cache.
    68  *
    69  * @since BuddyPress (2.2.0)
    70  *
    71  * @uses wp_cache_set()
    72  * @see WP_Object_Cache::set()
    73  *
    74  * @param  int|string $key    What to call the contents in the cache
    75  * @param  mixed      $data   The contents to store in the cache
    76  * @param  string     $group  Where to group the cache contents
    77  * @param  int        $expire When to expire the cache contents
    78  * @return bool               False on failure, true on success
    79  */
    80 function bp_cache_set( $key, $data, $group = '', $expire = 0 ) {
    81     $cache_key = bp_get_root_blog_cache_key( $key );
    82 
    83     return wp_cache_set( $cache_key, $data, $group, $expire );
    84 }
    85 
    86 /**
    87  * Removes the cache contents matching key and group.
    88  *
    89  * @since BuddyPress (2.2.0)
    90  *
    91  * @uses wp_cache_delete()
    92  * @see WP_Object_Cache::delete()
    93  *
    94  * @param  int|string $key   What the contents in the cache are called
    95  * @param  string     $group Where the cache contents are grouped
    96  * @return bool              True on successful removal, false on failure
    97  */
    98 function bp_cache_delete( $key, $group = '' ) {
    99     $cache_key = bp_get_root_blog_cache_key( $key );
    100 
    101     return wp_cache_delete( $cache_key, $group );
    10227}
    10328
Note: See TracChangeset for help on using the changeset viewer.