Changeset 7990 for trunk/wp-includes/cache.php
- Timestamp:
- 05/25/2008 03:45:05 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/cache.php
r7986 r7990 2 2 /** 3 3 * Object Cache API 4 * 5 * @link http://codex.wordpress.org/Function_Reference/WP_Cache 4 6 * 5 7 * @package WordPress … … 8 10 9 11 /** 10 * wp_cache_add() - Adds data to the cache, if the cache key doesn't aleady exist12 * Adds data to the cache, if the cache key doesn't aleady exist. 11 13 * 12 14 * @since 2.0 … … 27 29 28 30 /** 29 * wp_cache_close() - Closes the cache 30 * 31 * This function has ceased to do anything since WordPress 2.5. 32 * The functionality was removed along with the rest of the 33 * persistant cache. 31 * Closes the cache. 32 * 33 * This function has ceased to do anything since WordPress 2.5. The 34 * functionality was removed along with the rest of the persistant cache. This 35 * does not mean that plugins can't implement this function when they need to 36 * make sure that the cache is cleaned up after WordPress no longer needs it. 34 37 * 35 38 * @since 2.0 … … 42 45 43 46 /** 44 * wp_cache_delete() - Removes the cache contents matching ID and flag47 * Removes the cache contents matching ID and flag. 45 48 * 46 49 * @since 2.0 … … 59 62 60 63 /** 61 * wp_cache_flush() - Removes all cache items64 * Removes all cache items. 62 65 * 63 66 * @since 2.0 … … 74 77 75 78 /** 76 * wp_cache_get() - Retrieves the cache contents from the cache by ID and flag79 * Retrieves the cache contents from the cache by ID and flag. 77 80 * 78 81 * @since 2.0 … … 82 85 * @param int|string $id What the contents in the cache are called 83 86 * @param string $flag Where the cache contents are grouped 84 * @return bool|mixed False on failure to retrieve contents or the cache contents on success 87 * @return bool|mixed False on failure to retrieve contents or the cache 88 * contents on success 85 89 */ 86 90 function wp_cache_get($id, $flag = '') { … … 91 95 92 96 /** 93 * wp_cache_init() - Sets up Object Cache Global and assigns it97 * Sets up Object Cache Global and assigns it. 94 98 * 95 99 * @since 2.0 … … 101 105 102 106 /** 103 * wp_cache_replace() - Replaces the contents of the cache with new data107 * Replaces the contents of the cache with new data. 104 108 * 105 109 * @since 2.0 … … 120 124 121 125 /** 122 * wp_cache_set() - Saves the data to the cache126 * Saves the data to the cache. 123 127 * 124 128 * @since 2.0 … … 139 143 140 144 /** 141 * wp_cache_add_global_groups() - Adds a group or set of groups to the list of global groups145 * Adds a group or set of groups to the list of global groups. 142 146 * 143 147 * @since 2.6 … … 151 155 152 156 /** 153 * wp_cache_add_non_persistent_groups() - Adds a group or set of groups to the list of non-persistent groups157 * Adds a group or set of groups to the list of non-persistent groups. 154 158 * 155 159 * @since 2.6 … … 165 169 * WordPress Object Cache 166 170 * 167 * The WordPress Object Cache is used to save on trips to the database. 168 * The Object Cache stores all of the cache data to memory and makes the169 * c ache contents available by using a key, which is used to name and170 * later retrievethe cache contents.171 * 172 * The Object Cache can be replaced by other caching mechanisms by placing 173 * files in the wp-content folder which is looked at in wp-settings. If174 * that fileexists, then this file will not be included.171 * The WordPress Object Cache is used to save on trips to the database. The 172 * Object Cache stores all of the cache data to memory and makes the cache 173 * contents available by using a key, which is used to name and later retrieve 174 * the cache contents. 175 * 176 * The Object Cache can be replaced by other caching mechanisms by placing files 177 * in the wp-content folder which is looked at in wp-settings. If that file 178 * exists, then this file will not be included. 175 179 * 176 180 * @package WordPress … … 220 224 * 221 225 * @uses WP_Object_Cache::get Checks to see if the cache already has data. 222 * @uses WP_Object_Cache::set Sets the data after the checking the cache contents existance. 226 * @uses WP_Object_Cache::set Sets the data after the checking the cache 227 * contents existance. 223 228 * 224 229 * @since 2.0 … … 243 248 * Remove the contents of the cache ID in the group 244 249 * 245 * If the cache ID does not exist in the group and $force parameter 246 * is set to false, then nothing will happen. The $force parameter247 * is set to falseby default.248 * 249 * On success the group and the id will be added to the 250 * If the cache ID does not exist in the group and $force parameter is set 251 * to false, then nothing will happen. The $force parameter is set to false 252 * by default. 253 * 254 * On success the group and the id will be added to the 250 255 * $non_existant_objects property in the class. 251 256 * … … 254 259 * @param int|string $id What the contents in the cache are called 255 260 * @param string $group Where the cache contents are grouped 256 * @param bool $force Optional. Whether to force the unsetting of the cache ID in the group 261 * @param bool $force Optional. Whether to force the unsetting of the cache 262 * ID in the group 257 263 * @return bool False if the contents weren't deleted and true on success 258 264 */ … … 285 291 * Retrieves the cache contents, if it exists 286 292 * 287 * The contents will be first attempted to be retrieved by searching 288 * by the ID in the cache group. If the cache is hit (success) then289 * the contentsare returned.290 * 291 * On failure, the $non_existant_objects property is checked and if 292 * thecache group and ID exist in there the cache misses will not be293 * incremented. If not in the nonexistant objects property, then the 294 * cache misses will be incremented and the cache group and ID will295 * be added tothe nonexistant objects.293 * The contents will be first attempted to be retrieved by searching by the 294 * ID in the cache group. If the cache is hit (success) then the contents 295 * are returned. 296 * 297 * On failure, the $non_existant_objects property is checked and if the 298 * cache group and ID exist in there the cache misses will not be 299 * incremented. If not in the nonexistant objects property, then the cache 300 * misses will be incremented and the cache group and ID will be added to 301 * the nonexistant objects. 296 302 * 297 303 * @since 2.0 … … 299 305 * @param int|string $id What the contents in the cache are called 300 306 * @param string $group Where the cache contents are grouped 301 * @return bool|mixed False on failure to retrieve contents or the cache contents on success 307 * @return bool|mixed False on failure to retrieve contents or the cache 308 * contents on success 302 309 */ 303 310 function get($id, $group = 'default') { … … 343 350 * Sets the data contents into the cache 344 351 * 345 * The cache contents is grouped by the $group parameter followed 346 * by the $id. This allows for duplicate ids in unique groups. 347 * Therefore, naming of the group should be used with care and 348 * should follow normal function naming guidelines outside of 349 * core WordPress usage. 350 * 351 * The $expire parameter is not used, because the cache will 352 * automatically expire for each time a page is accessed and PHP 353 * finishes. The method is more for cache plugins which use files. 352 * The cache contents is grouped by the $group parameter followed by the 353 * $id. This allows for duplicate ids in unique groups. Therefore, naming of 354 * the group should be used with care and should follow normal function 355 * naming guidelines outside of core WordPress usage. 356 * 357 * The $expire parameter is not used, because the cache will automatically 358 * expire for each time a page is accessed and PHP finishes. The method is 359 * more for cache plugins which use files. 354 360 * 355 361 * @since 2.0 … … 379 385 * Echos the stats of the caching. 380 386 * 381 * Gives the cache hits, and cache misses. Also prints every cached 382 * group,key and the data.387 * Gives the cache hits, and cache misses. Also prints every cached group, 388 * key and the data. 383 389 * 384 390 * @since 2.0 … … 418 424 */ 419 425 function __construct() { 420 register_shutdown_function(array(&$this, "__destruct")); /** @todo This should be moved to the PHP4 style constructor, PHP5 already calls __destruct() */ 426 /** 427 * @todo This should be moved to the PHP4 style constructor, PHP5 428 * already calls __destruct() 429 */ 430 register_shutdown_function(array(&$this, "__destruct")); 421 431 } 422 432
Note: See TracChangeset
for help on using the changeset viewer.