Commit Graph

143 Commits

Author SHA1 Message Date
spacedmonkey 7a48bab20c Cache API: Add `wp_cache_flush_runtime` function
Add a new function called `wp_cache_flush_runtime` to existing caching functions found in WordPress. This function allows users to flush the runtime (in-memory) cache, without flushing the entire persistent cache. 

Props: Spacedmonkey, tillkruess, flixos90, adamsilverstein, SergeyBiryukov, barryhughes. 
Fixes: #55080.


Built from https://develop.svn.wordpress.org/trunk@52772


git-svn-id: http://core.svn.wordpress.org/trunk@52361 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-02-18 12:06:03 +00:00
Sergey Biryukov 11691e8207 Docs: Improve `@return` tags for `wp_cache_*_multiple()` functions:
* `wp_cache_add_multiple()`
* `wp_cache_set_multiple()`
* `wp_cache_get_multiple()`
* `wp_cache_delete_multiple()`

This aims to provide more details about the returned value types.

Follow-up to [52700], [52702], [52703].

See #54729, #54574.
Built from https://develop.svn.wordpress.org/trunk@52708


git-svn-id: http://core.svn.wordpress.org/trunk@52297 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-02-11 19:21:01 +00:00
Sergey Biryukov 6f3fcdcb4b Cache API: Reorder object cache functions and methods for consistency.
The original order was alphabetical, which became less obvious as newer functions got added, resulting in a somewhat random order.

This commits aims to organize the functions and related `WP_Object_Cache` methods in a more predictable order:

* `wp_cache_init()`
* `wp_cache_add()`
* `wp_cache_add_multiple()`
* `wp_cache_replace()`
* `wp_cache_set()`
* `wp_cache_set_multiple()`
* `wp_cache_get()`
* `wp_cache_get_multiple()`
* `wp_cache_delete()`
* `wp_cache_delete_multiple()`
* `wp_cache_incr()`
* `wp_cache_decr()`
* `wp_cache_flush()`
* `wp_cache_close()`
* `wp_cache_add_global_groups()`
* `wp_cache_add_non_persistent_groups()`
* `wp_cache_switch_to_blog()`
* `wp_cache_reset()`

Follow-up to [3011], [6543], [7986], [13066], [18580], [21403], [47938], [52700], [52703-52705].

See #54728, #54574.
Built from https://develop.svn.wordpress.org/trunk@52706


git-svn-id: http://core.svn.wordpress.org/trunk@52295 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-02-11 18:49:03 +00:00
Sergey Biryukov d3f69d117c Docs: Correct the suggested alternative for the deprecated `wp_cache_reset()` function.
While this was previously added and reverted more than once as part of various documentation cleanup efforts, `wp_cache_switch_to_blog()` appears to be the correct alternative for `wp_cache_reset()`, per the latter's DocBlock.

This commit also corrects the `@deprecated` tag for `WP_Object_Cache::reset()` to link to the `::switch_to_blog()` method of the class, instead of the function of the same name.

Follow-up to [13066], [21403], [22111], [33678], [34225], [34226], [40929].

See #54729.
Built from https://develop.svn.wordpress.org/trunk@52705


git-svn-id: http://core.svn.wordpress.org/trunk@52294 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-02-11 18:33:00 +00:00
Sergey Biryukov 42e1bea8f1 Docs: Correct `@since` tag for `wp_cache_reset()`.
The function was added in WordPress 3.0, not 2.6.

Follow-up to [13066].

See #54729.
Built from https://develop.svn.wordpress.org/trunk@52704


git-svn-id: http://core.svn.wordpress.org/trunk@52293 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-02-11 18:05:03 +00:00
Sergey Biryukov 7f36a90e0e Docs: Update DocBlocks for some object cache functions per the documentation standards.
Follow-up to [47060], [47938], [47944], [52700].

See #54729, #54574.
Built from https://develop.svn.wordpress.org/trunk@52703


git-svn-id: http://core.svn.wordpress.org/trunk@52292 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-02-11 17:44:01 +00:00
spacedmonkey a3f3c5c959 Cache: Add `wp_cache_*_multiple` functions.
Add new caching functions named `wp_cache_add_multiple`, `wp_cache_set_multiple` and `wp_cache_delete_multiple`. All of these functions allow for an array of data to be passed, so that multiple cache objects can be created / edited / deleted in a single function call. This follows on from [47938] where the `wp_cache_get_multiple` function was introduced and allowed for multiple cache objects to be received in one call. 

Props: spacedmonkey, tillkruess, adamsilverstein, flixos90, mitogh, pbearne. 
Fixes: #54574.

Built from https://develop.svn.wordpress.org/trunk@52700


git-svn-id: http://core.svn.wordpress.org/trunk@52289 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-02-11 12:51:59 +00:00
John Blackbourn f4cda1b62f Docs: Upgrade more parameters in docblocks to used typed array notation.
See #51800, #41756

Built from https://develop.svn.wordpress.org/trunk@49693


git-svn-id: http://core.svn.wordpress.org/trunk@49416 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-11-24 21:27:05 +00:00
John Blackbourn 57a3f803ae Docs: First pass at some inline docs fixes mostly made by PHPCBF.
See #49572, #50744
Built from https://develop.svn.wordpress.org/trunk@48586


git-svn-id: http://core.svn.wordpress.org/trunk@48348 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-23 20:01:04 +00:00
Sergey Biryukov 1d95eb63a7 Docs: Add missing documentation for the `$group` parameter of `WP_Object_Cache::get_multiple()`.
Synchronize documentation between `wp_cache_get_multiple()`, its compat version, and the class method.

See #20875.
Built from https://develop.svn.wordpress.org/trunk@47944


git-svn-id: http://core.svn.wordpress.org/trunk@47717 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-10 09:57:09 +00:00
whyisjake 3e2b649351 Cache API: Introduce `wp_cache_get_multi()`.
Many caching backend have support for multiple gets in a single request. This brings that support to core, with a compatability fallback that will loop over requests if needed.

Fixes: #20875.
Props: nacin, tollmanz, wonderboymusic, ryan, jeremyfelt, spacedmonkey, boonebgorges, dd32, rmccue, ocean90, jipmoors, johnjamesjacoby, tillkruess, donmhico, davidbaumwald, SergeyBiryukov, whyisjake.


Built from https://develop.svn.wordpress.org/trunk@47938


git-svn-id: http://core.svn.wordpress.org/trunk@47711 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-09 19:47:13 +00:00
Sergey Biryukov ecb8633dcc Coding Standards: Move `WP_Object_Cache` to `wp-includes/class-wp-object-cache.php`.
This ensures the file containing the `WP_Object_Cache` class conforms to the coding standards.

For backward compatibility, the new file is included from `wp-includes/cache.php`.

Fixes #49373. See #49222.
Built from https://develop.svn.wordpress.org/trunk@47197


git-svn-id: http://core.svn.wordpress.org/trunk@46997 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-02-06 05:53:06 +00:00
Sergey Biryukov c67b2c235a Cache API: Remove `WP_Object_Cache::__destruct()` and `wpdb::__destruct()`.
Originally added in [4686], these constructor/destructor pairings were designed to prevent the objects from being destroyed before shutdown, when output buffers are flushed.

A deeper investigation reveals that this approach didn't quite work as expected and was later made redundant by introducing `wp_ob_end_flush_all()` in [5462].

Props wonderboymusic, nacin, Mte90, SergeyBiryukov.
Fixes #21402.
Built from https://develop.svn.wordpress.org/trunk@47107


git-svn-id: http://core.svn.wordpress.org/trunk@46907 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-01-23 00:27:05 +00:00
Sergey Biryukov dd4d98a368 Docs: In various `@return` tags, list the expected type first, instead of `false`.
Follow-up to [46696].

See #48303.
Built from https://develop.svn.wordpress.org/trunk@47060


git-svn-id: http://core.svn.wordpress.org/trunk@46860 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-01-11 18:32:05 +00:00
Sergey Biryukov ed4f394b67 Docs: Correct type for `WP_Object_Cache::$blog_prefix`.
Props diddledan.
Fixes #46851.
Built from https://develop.svn.wordpress.org/trunk@45161


git-svn-id: http://core.svn.wordpress.org/trunk@44970 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-04-11 20:10:53 +00:00
desrosj 03240dd3f4 Docs: Correct various spelling mistakes.
Props man4toman.
Fixes #46339.
Built from https://develop.svn.wordpress.org/trunk@44894


git-svn-id: http://core.svn.wordpress.org/trunk@44725 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-13 19:32:53 +00:00
Gary Pendergast a5d8a6bde3 Docs: Fix the `WP_Object_Cache::get()` docblock.
The `$force` parameter is a `bool`, not a `string`. The matching `wp_cache_get()` docblock has the correct type.

Props subrataemfluence.
Fixes #44454.


Built from https://develop.svn.wordpress.org/trunk@44601


git-svn-id: http://core.svn.wordpress.org/trunk@44432 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-01-15 06:18:51 +00:00
Gary Pendergast aaf99e6913 Code is Poetry.
WordPress' code just... wasn't.
This is now dealt with.

Props jrf, pento, netweb, GaryJ, jdgrimes, westonruter, Greg Sherwood from PHPCS, and everyone who's ever contributed to WPCS and PHPCS.
Fixes #41057.


Built from https://develop.svn.wordpress.org/trunk@42343


git-svn-id: http://core.svn.wordpress.org/trunk@42172 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-11-30 23:11:00 +00:00
John Blackbourn 4a16295dc5 Docs: Standardise the format used for documenting parameters passed by reference.
See #35974, #41017

Built from https://develop.svn.wordpress.org/trunk@41688


git-svn-id: http://core.svn.wordpress.org/trunk@41522 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-02 22:14:46 +00:00
Drew Jaynes 0860bb2771 Docs: Remove `@access` notations from method DocBlocks in wp-includes/* classes.
Prior to about 2013, many class methods lacked even access modifiers which made the `@access` notations that much more useful. Now that we've gotten to a point where the codebase is more mature from a maintenance perspective and we can finally remove these notations. Notable exceptions to this change include standalone functions notated as private as well as some classes still considered to represent "private" APIs.

See #41452.

Built from https://develop.svn.wordpress.org/trunk@41162


git-svn-id: http://core.svn.wordpress.org/trunk@41002 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-07-27 00:41:44 +00:00
Drew Jaynes 5c075e5af7 Docs: Remove a few more superfluous `@package WordPress` and `@subpackage` notations outside of file headers missed in [40988].
See #41017.

Built from https://develop.svn.wordpress.org/trunk@40989


git-svn-id: http://core.svn.wordpress.org/trunk@40839 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-07-01 17:11:41 +00:00
Drew Jaynes acea6cbad8 Improve the usefulness of several `_deprecated_function()` calls by passing known replacement functions, methods, or hooks.
Props jrf.
See #41121.

Built from https://develop.svn.wordpress.org/trunk@40929


git-svn-id: http://core.svn.wordpress.org/trunk@40779 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-06-25 00:05:44 +00:00
Drew Jaynes 5f4497f0af Docs: Fix multiple trivial typos throughout a variety of core files.
Props ottok.
Fixes #38489.

Built from https://develop.svn.wordpress.org/trunk@39051


git-svn-id: http://core.svn.wordpress.org/trunk@38993 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-31 06:28:32 +00:00
Scott Taylor e5225324a2 Multisite: use `get_current_blog_id()` where applicable, in lieu of plucking the `$blog_id` global from outer space.
See #37699.

Built from https://develop.svn.wordpress.org/trunk@38457


git-svn-id: http://core.svn.wordpress.org/trunk@38398 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-31 04:55:54 +00:00
Scott Taylor d6145020ae Cache: in `WP_Object_Cache`, `$cache_misses` is public, but `$cache_hits` is private. They should both be `public`, because they're useful for debugging purposes.
Props danielbachhuber.
Fixes #37726.

Built from https://develop.svn.wordpress.org/trunk@38335


git-svn-id: http://core.svn.wordpress.org/trunk@38276 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-08-23 14:38:29 +00:00
Sergey Biryukov 139387b7e5 Docs: Use 3-digit, x.x.x-style semantic versioning for `_doing_it_wrong()`, `_deprecated_function()`, `_deprecated_argument()`, and `_deprecated_file()` throughout core.
Props metodiew.
Fixes #36495.
Built from https://develop.svn.wordpress.org/trunk@37985


git-svn-id: http://core.svn.wordpress.org/trunk@37926 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-06 12:40:29 +00:00
Drew Jaynes 0016e4bb12 Docs: Fix an incorrect Codex link in the file header for wp-includes/cache.php.
Introduced in [7990].

Props michaelbeil.
See #36880.

Built from https://develop.svn.wordpress.org/trunk@37460


git-svn-id: http://core.svn.wordpress.org/trunk@37428 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-18 22:07:28 +00:00
Drew Jaynes b1804afeaf Docs: Standardize on 'backward compatibility/compatible' nomenclature in core inline docs.
Also use 'back-compat' in some inline comments where backward compatibility is the subject and shorthand feels more natural.

Note: 'backwards compatibility/compatibile' can also be considered correct, though it's primary seen in regular use in British English.

Props ocean90.
Fixes #36835.

Built from https://develop.svn.wordpress.org/trunk@37431


git-svn-id: http://core.svn.wordpress.org/trunk@37397 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-13 18:41:31 +00:00
Sergey Biryukov fc9d56c13f Docs: Fix typo in `wp_cache_switch_to_blog()` and `WP_Object_Cache::switch_to_blog()` description.
Props bobbingwide.
Fixes #36548.
Built from https://develop.svn.wordpress.org/trunk@37216


git-svn-id: http://core.svn.wordpress.org/trunk@37182 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-04-16 12:37:30 +00:00
Dominik Schilling e5ea82d81a Spelling: Standardize on "front end"/"back end" (noun) and "front-end"/"back-end" (adjective).
Props obrienlabs, thewanderingbrit.
Fixes #34887.
Built from https://develop.svn.wordpress.org/trunk@36709


git-svn-id: http://core.svn.wordpress.org/trunk@36676 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-25 12:53:27 +00:00
Eric Lewis 22467e840f Networks and sites: Replace "blog" usage with "site" in docs.
Multisite functions use the term "blog" to refer to what we now call a "site," e.g. `get_current_blog_id()`. These functions are here to stay because of our commitment to backwards compatibility. What we can do is set the documentation straight.

See #35417.

Built from https://develop.svn.wordpress.org/trunk@36416


git-svn-id: http://core.svn.wordpress.org/trunk@36383 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-01-28 03:35:27 +00:00
John Blackbourn 1402c3d8b4 Docs: Miscellaneous docblock corrections.
See #32246

Built from https://develop.svn.wordpress.org/trunk@36069


git-svn-id: http://core.svn.wordpress.org/trunk@36034 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-23 06:31:27 +00:00
Drew Jaynes 81524f3bfc Filesystem: Following the introduction of the `KB|MB|GB|TB_IN_BYTES` constants in [35286], use them in various places in core.
Props sudar.
Fixes #22405.

Built from https://develop.svn.wordpress.org/trunk@35325


git-svn-id: http://core.svn.wordpress.org/trunk@35291 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-21 14:03:25 +00:00
Drew Jaynes 4279a9c39e Docs: Improve documentation for the `WP_Object_Cache` class.
Spaces out parameter documentation for readability, fixes some minor syntactical issues, and adds some missing `@access` tags or reorders tags according to the PHP docs standards.

Also, documents `&$found`, the fourth parameter for the `get()` method, and adds missing parameter and return descriptions for the `_exists()` utility method.

See #32246.

Built from https://develop.svn.wordpress.org/trunk@34227


git-svn-id: http://core.svn.wordpress.org/trunk@34191 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-16 10:03:26 +00:00
Drew Jaynes 5172621c1d Docs: Remove an errant change made to a `_deprecated_function()` call in `wp_cache_reset()` introduced in [34225].
See #32246.

Built from https://develop.svn.wordpress.org/trunk@34226


git-svn-id: http://core.svn.wordpress.org/trunk@34190 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-16 09:42:24 +00:00
Drew Jaynes 4e4737685e Docs: Add more complete documentation for top-level object cache functionality.
Adds some `@see` tags for corresponding `WP_Object_Cache` methods to DocBlocks for top-level functions. Also adds a standard description for the `@global` tags, spacing for parameter docs readability, and finally, properly marks optional parameters as such.

See #32246.

Built from https://develop.svn.wordpress.org/trunk@34225


git-svn-id: http://core.svn.wordpress.org/trunk@34189 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-16 09:40:25 +00:00
Scott Taylor 641c07533d Clarify `wp-includes/cache.php` docs with some more precise language.
Props danielbachhuber.
Fixes #33734.

Built from https://develop.svn.wordpress.org/trunk@34010


git-svn-id: http://core.svn.wordpress.org/trunk@33979 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-10 18:24:24 +00:00
Scott Taylor d5f666013f Fix copy pasta in `wp_cache_decr()` doc block.
Props danielbachhuber.
Fixes #33548.

Built from https://develop.svn.wordpress.org/trunk@33809


git-svn-id: http://core.svn.wordpress.org/trunk@33777 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-30 03:04:21 +00:00
Drew Jaynes bf371f1577 Docs: Standardize `@deprecated` tag formatting in the DocBlock for `WP_Object_Cache:reset()`.
Props Alphawolf.
See #28806.

Built from https://develop.svn.wordpress.org/trunk@33678


git-svn-id: http://core.svn.wordpress.org/trunk@33645 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-20 22:39:24 +00:00
Scott Taylor ebd3201268 Add/standardize missing doc blocks for `cache.php`.
See #32444.

Built from https://develop.svn.wordpress.org/trunk@32539


git-svn-id: http://core.svn.wordpress.org/trunk@32509 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-22 04:24:26 +00:00
Scott Taylor 9b3271f635 In `cache.php`, clarify some `return` docs. Some `WP_Object_Cache` methods return `void`, so those wrapper functions don't need to return at all.
See #32444.

Built from https://develop.svn.wordpress.org/trunk@32528


git-svn-id: http://core.svn.wordpress.org/trunk@32498 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-21 20:22:24 +00:00
Dominik Schilling 64fc7294b6 Use HTTPS URLs for codex.wordpress.org.
see #27115.
Built from https://develop.svn.wordpress.org/trunk@32116


git-svn-id: http://core.svn.wordpress.org/trunk@32095 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-04-12 21:29:32 +00:00
Scott Taylor 2bcae51cfd Declare `multisite` as a field for `WP_Object_Cache`.
See #30799.

Built from https://develop.svn.wordpress.org/trunk@31682


git-svn-id: http://core.svn.wordpress.org/trunk@31663 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-09 02:18:27 +00:00
Scott Taylor dccf5ceb90 Empty `return` statements are unnecessary at the end of functions.
See #30799.

Built from https://develop.svn.wordpress.org/trunk@31679


git-svn-id: http://core.svn.wordpress.org/trunk@31660 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-08 23:09:27 +00:00
Scott Taylor 0a511680f4 Adding a `@return` annotation to constructors is generally not recommended as a constructor does not have a meaningful return value. Constructors do not have meaningful return values, anything that is returned from here is discarded.
See #30799.

Built from https://develop.svn.wordpress.org/trunk@31126


git-svn-id: http://core.svn.wordpress.org/trunk@31107 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-10 06:54:23 +00:00
Scott Taylor e619abda6e Improve various `@param` docs for `src/wp-includes/*`.
See #30224.

Built from https://develop.svn.wordpress.org/trunk@30681


git-svn-id: http://core.svn.wordpress.org/trunk@30671 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-12-01 01:34:24 +00:00
Drew Jaynes a8583d5f19 Fix some words that aren't words.
See #28885.

Built from https://develop.svn.wordpress.org/trunk@29454


git-svn-id: http://core.svn.wordpress.org/trunk@29232 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-08-09 19:30:17 +00:00
Drew Jaynes 3665b5a1a1 Add periods to short descriptions for magic methods added in [28501], [28521], and [28524].
See #22234 and #28885.

Built from https://develop.svn.wordpress.org/trunk@29165


git-svn-id: http://core.svn.wordpress.org/trunk@28949 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-14 01:12:14 +00:00
Drew Jaynes 915777e073 Fill out inline documentation for magic methods added to the `WP_Object_Cache` class in [28502], [28521], [28524].
See #27881, #22234 and #28885.

Built from https://develop.svn.wordpress.org/trunk@29146


git-svn-id: http://core.svn.wordpress.org/trunk@28930 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-13 23:46:14 +00:00
Scott Taylor 85f73cf458 Classes that have `__set()` also need `__isset()` and `__unset()`.
See #27881, #22234.

Built from https://develop.svn.wordpress.org/trunk@28524


git-svn-id: http://core.svn.wordpress.org/trunk@28350 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-05-19 06:52:14 +00:00