ꦆꦤ꧀ꦝꦿꦩꦪꦸꦲꦕ꧀ꦏꦺꦂꦠꦼꦄꦩ꧀
/
home
/
banildaco
/
public_html
/
wp-includes
/
Nama File / Folder
Size
Action
ID3
--
NONE
IXR
--
NONE
PHPMailer
--
NONE
Requests
--
NONE
SimplePie
--
NONE
Text
--
NONE
abilities-api
--
NONE
assets
--
NONE
block-bindings
--
NONE
block-patterns
--
NONE
block-supports
--
NONE
blocks
--
NONE
certificates
--
NONE
css
--
NONE
customize
--
NONE
fonts
--
NONE
html-api
--
NONE
images
--
NONE
interactivity-api
--
NONE
js
--
NONE
l10n
--
NONE
php-compat
--
NONE
pomo
--
NONE
rest-api
--
NONE
sitemaps
--
NONE
sodium_compat
--
NONE
style-engine
--
NONE
theme-compat
--
NONE
widgets
--
NONE
abilities-api.php
23.798KB
Hapus
Edit
Rename
abilities.php
7.796KB
Hapus
Edit
Rename
admin-bar.php
36.1KB
Hapus
Edit
Rename
atomlib.php
11.896KB
Hapus
Edit
Rename
author-template.php
18.937KB
Hapus
Edit
Rename
block-bindings.php
7.35KB
Hapus
Edit
Rename
block-i18n.json
0.309KB
Hapus
Edit
Rename
block-patterns.php
12.903KB
Hapus
Edit
Rename
block-template-utils.php
61.02KB
Hapus
Edit
Rename
block-template.php
14.999KB
Hapus
Edit
Rename
blocks.php
112.05KB
Hapus
Edit
Rename
bookmark-template.php
12.469KB
Hapus
Edit
Rename
bookmark.php
15.065KB
Hapus
Edit
Rename
cache-compat.php
9.842KB
Hapus
Edit
Rename
cache.php
13.17KB
Hapus
Edit
Rename
canonical.php
33.833KB
Hapus
Edit
Rename
capabilities.php
42.629KB
Hapus
Edit
Rename
category-template.php
55.708KB
Hapus
Edit
Rename
category.php
12.528KB
Hapus
Edit
Rename
class-IXR.php
2.555KB
Hapus
Edit
Rename
class-avif-info.php
28.921KB
Hapus
Edit
Rename
class-feed.php
0.526KB
Hapus
Edit
Rename
class-http.php
0.358KB
Hapus
Edit
Rename
class-json.php
42.652KB
Hapus
Edit
Rename
class-oembed.php
0.392KB
Hapus
Edit
Rename
class-phpass.php
6.612KB
Hapus
Edit
Rename
class-phpmailer.php
0.648KB
Hapus
Edit
Rename
class-pop3.php
20.626KB
Hapus
Edit
Rename
class-requests.php
2.185KB
Hapus
Edit
Rename
class-simplepie.php
0.442KB
Hapus
Edit
Rename
class-smtp.php
0.446KB
Hapus
Edit
Rename
class-snoopy.php
36.831KB
Hapus
Edit
Rename
class-walker-category-dropdown.php
2.411KB
Hapus
Edit
Rename
class-walker-category.php
8.278KB
Hapus
Edit
Rename
class-walker-comment.php
13.888KB
Hapus
Edit
Rename
class-walker-nav-menu.php
11.762KB
Hapus
Edit
Rename
class-walker-page-dropdown.php
2.646KB
Hapus
Edit
Rename
class-walker-page.php
7.434KB
Hapus
Edit
Rename
class-wp-admin-bar.php
17.455KB
Hapus
Edit
Rename
class-wp-ajax-response.php
5.143KB
Hapus
Edit
Rename
class-wp-application-passwords.php
16.698KB
Hapus
Edit
Rename
class-wp-block-bindings-registry.php
8.283KB
Hapus
Edit
Rename
class-wp-block-bindings-source.php
2.922KB
Hapus
Edit
Rename
class-wp-block-editor-context.php
1.318KB
Hapus
Edit
Rename
class-wp-block-list.php
4.603KB
Hapus
Edit
Rename
class-wp-block-metadata-registry.php
11.616KB
Hapus
Edit
Rename
class-wp-block-parser-block.php
2.495KB
Hapus
Edit
Rename
class-wp-block-parser-frame.php
1.97KB
Hapus
Edit
Rename
class-wp-block-pattern-categories-registry.php
5.322KB
Hapus
Edit
Rename
class-wp-block-patterns-registry.php
10.597KB
Hapus
Edit
Rename
class-wp-block-processor.php
68.319KB
Hapus
Edit
Rename
class-wp-block-styles-registry.php
6.345KB
Hapus
Edit
Rename
class-wp-block-supports.php
5.494KB
Hapus
Edit
Rename
class-wp-block-template.php
1.985KB
Hapus
Edit
Rename
class-wp-block-templates-registry.php
7.024KB
Hapus
Edit
Rename
class-wp-block-type-registry.php
4.912KB
Hapus
Edit
Rename
class-wp-block-type.php
16.86KB
Hapus
Edit
Rename
class-wp-block.php
24.23KB
Hapus
Edit
Rename
class-wp-classic-to-block-menu-converter.php
3.975KB
Hapus
Edit
Rename
class-wp-comment-query.php
47.66KB
Hapus
Edit
Rename
class-wp-comment.php
9.216KB
Hapus
Edit
Rename
class-wp-customize-control.php
25.507KB
Hapus
Edit
Rename
class-wp-customize-manager.php
198.378KB
Hapus
Edit
Rename
class-wp-customize-nav-menus.php
56.653KB
Hapus
Edit
Rename
class-wp-customize-panel.php
10.459KB
Hapus
Edit
Rename
class-wp-customize-section.php
10.946KB
Hapus
Edit
Rename
class-wp-customize-setting.php
29.26KB
Hapus
Edit
Rename
class-wp-customize-widgets.php
70.905KB
Hapus
Edit
Rename
class-wp-date-query.php
35.3KB
Hapus
Edit
Rename
class-wp-dependencies.php
16.605KB
Hapus
Edit
Rename
class-wp-dependency.php
2.571KB
Hapus
Edit
Rename
class-wp-duotone.php
39.827KB
Hapus
Edit
Rename
class-wp-editor.php
70.64KB
Hapus
Edit
Rename
class-wp-embed.php
15.558KB
Hapus
Edit
Rename
class-wp-error.php
7.326KB
Hapus
Edit
Rename
class-wp-exception.php
0.247KB
Hapus
Edit
Rename
class-wp-fatal-error-handler.php
7.959KB
Hapus
Edit
Rename
class-wp-feed-cache-transient.php
3.227KB
Hapus
Edit
Rename
class-wp-feed-cache.php
0.946KB
Hapus
Edit
Rename
class-wp-hook.php
16.283KB
Hapus
Edit
Rename
class-wp-http-cookie.php
7.216KB
Hapus
Edit
Rename
class-wp-http-curl.php
12.95KB
Hapus
Edit
Rename
class-wp-http-encoding.php
6.532KB
Hapus
Edit
Rename
class-wp-http-ixr-client.php
3.419KB
Hapus
Edit
Rename
class-wp-http-proxy.php
5.84KB
Hapus
Edit
Rename
class-wp-http-requests-hooks.php
1.975KB
Hapus
Edit
Rename
class-wp-http-requests-response.php
4.297KB
Hapus
Edit
Rename
class-wp-http-response.php
2.907KB
Hapus
Edit
Rename
class-wp-http-streams.php
16.464KB
Hapus
Edit
Rename
class-wp-http.php
40.596KB
Hapus
Edit
Rename
class-wp-image-editor-gd.php
20.22KB
Hapus
Edit
Rename
class-wp-image-editor-imagick.php
36.11KB
Hapus
Edit
Rename
class-wp-image-editor.php
17.007KB
Hapus
Edit
Rename
class-wp-list-util.php
7.269KB
Hapus
Edit
Rename
class-wp-locale-switcher.php
6.617KB
Hapus
Edit
Rename
class-wp-locale.php
16.487KB
Hapus
Edit
Rename
class-wp-matchesmapregex.php
1.785KB
Hapus
Edit
Rename
class-wp-meta-query.php
29.817KB
Hapus
Edit
Rename
class-wp-metadata-lazyloader.php
6.673KB
Hapus
Edit
Rename
class-wp-navigation-fallback.php
8.978KB
Hapus
Edit
Rename
class-wp-network-query.php
19.421KB
Hapus
Edit
Rename
class-wp-network.php
12.008KB
Hapus
Edit
Rename
class-wp-object-cache.php
17.113KB
Hapus
Edit
Rename
class-wp-oembed-controller.php
6.743KB
Hapus
Edit
Rename
class-wp-oembed.php
30.928KB
Hapus
Edit
Rename
class-wp-paused-extensions-storage.php
4.991KB
Hapus
Edit
Rename
class-wp-phpmailer.php
4.246KB
Hapus
Edit
Rename
class-wp-plugin-dependencies.php
24.722KB
Hapus
Edit
Rename
class-wp-post-type.php
29.961KB
Hapus
Edit
Rename
class-wp-post.php
6.339KB
Hapus
Edit
Rename
class-wp-query.php
159.906KB
Hapus
Edit
Rename
class-wp-recovery-mode-cookie-service.php
6.716KB
Hapus
Edit
Rename
class-wp-recovery-mode-email-service.php
10.921KB
Hapus
Edit
Rename
class-wp-recovery-mode-key-service.php
4.77KB
Hapus
Edit
Rename
class-wp-recovery-mode-link-service.php
3.382KB
Hapus
Edit
Rename
class-wp-recovery-mode.php
11.185KB
Hapus
Edit
Rename
class-wp-rewrite.php
62.194KB
Hapus
Edit
Rename
class-wp-role.php
2.464KB
Hapus
Edit
Rename
class-wp-roles.php
9.174KB
Hapus
Edit
Rename
class-wp-script-modules.php
32.146KB
Hapus
Edit
Rename
class-wp-scripts.php
34.047KB
Hapus
Edit
Rename
class-wp-session-tokens.php
7.147KB
Hapus
Edit
Rename
class-wp-simplepie-file.php
3.469KB
Hapus
Edit
Rename
class-wp-simplepie-sanitize-kses.php
1.865KB
Hapus
Edit
Rename
class-wp-site-query.php
30.913KB
Hapus
Edit
Rename
class-wp-site.php
7.292KB
Hapus
Edit
Rename
class-wp-speculation-rules.php
7.351KB
Hapus
Edit
Rename
class-wp-styles.php
12.542KB
Hapus
Edit
Rename
class-wp-tax-query.php
19.118KB
Hapus
Edit
Rename
class-wp-taxonomy.php
18.124KB
Hapus
Edit
Rename
class-wp-term-query.php
39.993KB
Hapus
Edit
Rename
class-wp-term.php
5.174KB
Hapus
Edit
Rename
class-wp-text-diff-renderer-inline.php
0.956KB
Hapus
Edit
Rename
class-wp-text-diff-renderer-table.php
18.438KB
Hapus
Edit
Rename
class-wp-textdomain-registry.php
10.235KB
Hapus
Edit
Rename
class-wp-theme-json-data.php
1.767KB
Hapus
Edit
Rename
class-wp-theme-json-resolver.php
34.9KB
Hapus
Edit
Rename
class-wp-theme-json-schema.php
7.194KB
Hapus
Edit
Rename
class-wp-theme-json.php
160.495KB
Hapus
Edit
Rename
class-wp-theme.php
64.268KB
Hapus
Edit
Rename
class-wp-token-map.php
27.947KB
Hapus
Edit
Rename
class-wp-url-pattern-prefixer.php
4.689KB
Hapus
Edit
Rename
class-wp-user-meta-session-tokens.php
2.94KB
Hapus
Edit
Rename
class-wp-user-query.php
43.131KB
Hapus
Edit
Rename
class-wp-user-request.php
2.251KB
Hapus
Edit
Rename
class-wp-user.php
22.504KB
Hapus
Edit
Rename
class-wp-walker.php
13.01KB
Hapus
Edit
Rename
class-wp-widget-factory.php
3.269KB
Hapus
Edit
Rename
class-wp-widget.php
17.997KB
Hapus
Edit
Rename
class-wp-xmlrpc-server.php
210.397KB
Hapus
Edit
Rename
class-wp.php
25.86KB
Hapus
Edit
Rename
class-wpdb.php
115.847KB
Hapus
Edit
Rename
class.wp-dependencies.php
0.364KB
Hapus
Edit
Rename
class.wp-scripts.php
0.335KB
Hapus
Edit
Rename
class.wp-styles.php
0.33KB
Hapus
Edit
Rename
comment-template.php
100.728KB
Hapus
Edit
Rename
comment.php
130.927KB
Hapus
Edit
Rename
compat-utf8.php
19.096KB
Hapus
Edit
Rename
compat.php
17.412KB
Hapus
Edit
Rename
cron.php
41.98KB
Hapus
Edit
Rename
date.php
0.391KB
Hapus
Edit
Rename
default-constants.php
11.099KB
Hapus
Edit
Rename
default-filters.php
37.021KB
Hapus
Edit
Rename
default-widgets.php
2.241KB
Hapus
Edit
Rename
deprecated.php
188.129KB
Hapus
Edit
Rename
embed-template.php
0.33KB
Hapus
Edit
Rename
embed.php
37.999KB
Hapus
Edit
Rename
error-protection.php
4.024KB
Hapus
Edit
Rename
error_log
186.633KB
Hapus
Edit
Rename
feed-atom-comments.php
5.375KB
Hapus
Edit
Rename
feed-atom.php
3.048KB
Hapus
Edit
Rename
feed-rdf.php
2.605KB
Hapus
Edit
Rename
feed-rss.php
1.161KB
Hapus
Edit
Rename
feed-rss2-comments.php
4.039KB
Hapus
Edit
Rename
feed-rss2.php
3.71KB
Hapus
Edit
Rename
feed.php
24.599KB
Hapus
Edit
Rename
fonts.php
9.561KB
Hapus
Edit
Rename
formatting.php
346.427KB
Hapus
Edit
Rename
functions.php
281.836KB
Hapus
Edit
Rename
functions.wp-scripts.php
14.952KB
Hapus
Edit
Rename
functions.wp-styles.php
8.438KB
Hapus
Edit
Rename
general-template.php
168.949KB
Hapus
Edit
Rename
global-styles-and-settings.php
20.707KB
Hapus
Edit
Rename
http.php
25.271KB
Hapus
Edit
Rename
https-detection.php
5.72KB
Hapus
Edit
Rename
https-migration.php
4.63KB
Hapus
Edit
Rename
kses.php
81.716KB
Hapus
Edit
Rename
l10n.php
67.185KB
Hapus
Edit
Rename
link-template.php
156.364KB
Hapus
Edit
Rename
load.php
55.186KB
Hapus
Edit
Rename
locale.php
0.158KB
Hapus
Edit
Rename
media-template.php
61.716KB
Hapus
Edit
Rename
media.php
216.002KB
Hapus
Edit
Rename
meta.php
64.996KB
Hapus
Edit
Rename
ms-blogs.php
25.239KB
Hapus
Edit
Rename
ms-default-constants.php
4.806KB
Hapus
Edit
Rename
ms-default-filters.php
6.48KB
Hapus
Edit
Rename
ms-deprecated.php
21.249KB
Hapus
Edit
Rename
ms-files.php
2.79KB
Hapus
Edit
Rename
ms-functions.php
89.689KB
Hapus
Edit
Rename
ms-load.php
19.421KB
Hapus
Edit
Rename
ms-network.php
3.693KB
Hapus
Edit
Rename
ms-settings.php
4.105KB
Hapus
Edit
Rename
ms-site.php
40.739KB
Hapus
Edit
Rename
nav-menu-template.php
25.381KB
Hapus
Edit
Rename
nav-menu.php
43.333KB
Hapus
Edit
Rename
option.php
102.573KB
Hapus
Edit
Rename
pluggable-deprecated.php
6.176KB
Hapus
Edit
Rename
pluggable.php
124.47KB
Hapus
Edit
Rename
plugin.php
35.646KB
Hapus
Edit
Rename
post-formats.php
6.936KB
Hapus
Edit
Rename
post-template.php
67.039KB
Hapus
Edit
Rename
post-thumbnail-template.php
10.624KB
Hapus
Edit
Rename
post.php
289.133KB
Hapus
Edit
Rename
query.php
36.226KB
Hapus
Edit
Rename
registration-functions.php
0.195KB
Hapus
Edit
Rename
registration.php
0.195KB
Hapus
Edit
Rename
rest-api.php
98.295KB
Hapus
Edit
Rename
revision.php
30.021KB
Hapus
Edit
Rename
rewrite.php
19.033KB
Hapus
Edit
Rename
robots-template.php
5.063KB
Hapus
Edit
Rename
rss-functions.php
0.249KB
Hapus
Edit
Rename
rss.php
22.659KB
Hapus
Edit
Rename
script-loader.php
154.633KB
Hapus
Edit
Rename
script-modules.php
9.679KB
Hapus
Edit
Rename
session.php
0.252KB
Hapus
Edit
Rename
shortcodes.php
23.486KB
Hapus
Edit
Rename
sitemaps.php
3.162KB
Hapus
Edit
Rename
speculative-loading.php
8.398KB
Hapus
Edit
Rename
spl-autoload-compat.php
0.431KB
Hapus
Edit
Rename
style-engine.php
7.386KB
Hapus
Edit
Rename
taxonomy.php
172.908KB
Hapus
Edit
Rename
template-canvas.php
0.531KB
Hapus
Edit
Rename
template-loader.php
3.837KB
Hapus
Edit
Rename
template.php
35.971KB
Hapus
Edit
Rename
theme-i18n.json
1.689KB
Hapus
Edit
Rename
theme-previews.php
2.842KB
Hapus
Edit
Rename
theme-templates.php
6.092KB
Hapus
Edit
Rename
theme.json
8.712KB
Hapus
Edit
Rename
theme.php
131.844KB
Hapus
Edit
Rename
update.php
37.454KB
Hapus
Edit
Rename
user.php
173.889KB
Hapus
Edit
Rename
utf8.php
7.09KB
Hapus
Edit
Rename
vars.php
6.408KB
Hapus
Edit
Rename
version.php
1.08KB
Hapus
Edit
Rename
widgets.php
69.462KB
Hapus
Edit
Rename
wp-db.php
0.435KB
Hapus
Edit
Rename
wp-diff.php
0.78KB
Hapus
Edit
Rename
<?php /** * Object Cache API: WP_Object_Cache class * * @package WordPress * @subpackage Cache * @since 5.4.0 */ /** * Core class that implements an object cache. * * The WordPress Object Cache is used to save on trips to the database. The * Object Cache stores all of the cache data to memory and makes the cache * contents available by using a key, which is used to name and later retrieve * the cache contents. * * The Object Cache can be replaced by other caching mechanisms by placing files * in the wp-content folder which is looked at in wp-settings. If that file * exists, then this file will not be included. * * @since 2.0.0 */ #[AllowDynamicProperties] class WP_Object_Cache { /** * Holds the cached objects. * * @since 2.0.0 * @var array */ private $cache = array(); /** * The amount of times the cache data was already stored in the cache. * * @since 2.5.0 * @var int */ public $cache_hits = 0; /** * Amount of times the cache did not have the request in cache. * * @since 2.0.0 * @var int */ public $cache_misses = 0; /** * List of global cache groups. * * @since 3.0.0 * @var string[] */ protected $global_groups = array(); /** * The blog prefix to prepend to keys in non-global groups. * * @since 3.5.0 * @var string */ private $blog_prefix; /** * Holds the value of is_multisite(). * * @since 3.5.0 * @var bool */ private $multisite; /** * Sets up object properties. * * @since 2.0.8 */ public function __construct() { $this->multisite = is_multisite(); $this->blog_prefix = $this->multisite ? get_current_blog_id() . ':' : ''; } /** * Makes private properties readable for backward compatibility. * * @since 4.0.0 * * @param string $name Property to get. * @return mixed Property. */ public function __get( $name ) { return $this->$name; } /** * Makes private properties settable for backward compatibility. * * @since 4.0.0 * * @param string $name Property to set. * @param mixed $value Property value. */ public function __set( $name, $value ) { $this->$name = $value; } /** * Makes private properties checkable for backward compatibility. * * @since 4.0.0 * * @param string $name Property to check if set. * @return bool Whether the property is set. */ public function __isset( $name ) { return isset( $this->$name ); } /** * Makes private properties un-settable for backward compatibility. * * @since 4.0.0 * * @param string $name Property to unset. */ public function __unset( $name ) { unset( $this->$name ); } /** * Serves as a utility function to determine whether a key is valid. * * @since 6.1.0 * * @param int|string $key Cache key to check for validity. * @return bool Whether the key is valid. */ protected function is_valid_key( $key ) { if ( is_int( $key ) ) { return true; } if ( is_string( $key ) && trim( $key ) !== '' ) { return true; } $type = gettype( $key ); if ( ! function_exists( '__' ) ) { wp_load_translations_early(); } $message = is_string( $key ) ? __( 'Cache key must not be an empty string.' ) /* translators: %s: The type of the given cache key. */ : sprintf( __( 'Cache key must be an integer or a non-empty string, %s given.' ), $type ); _doing_it_wrong( sprintf( '%s::%s', __CLASS__, debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS, 2 )[1]['function'] ), $message, '6.1.0' ); return false; } /** * Serves as a utility function to determine whether a key exists in the cache. * * @since 3.4.0 * * @param int|string $key Cache key to check for existence. * @param string $group Cache group for the key existence check. * @return bool Whether the key exists in the cache for the given group. */ protected function _exists( $key, $group ) { return isset( $this->cache[ $group ] ) && ( isset( $this->cache[ $group ][ $key ] ) || array_key_exists( $key, $this->cache[ $group ] ) ); } /** * Adds data to the cache if it doesn't already exist. * * @since 2.0.0 * * @uses WP_Object_Cache::_exists() Checks to see if the cache already has data. * @uses WP_Object_Cache::set() Sets the data after the checking the cache * contents existence. * * @param int|string $key What to call the contents in the cache. * @param mixed $data The contents to store in the cache. * @param string $group Optional. Where to group the cache contents. Default 'default'. * @param int $expire Optional. When to expire the cache contents, in seconds. * Default 0 (no expiration). * @return bool True on success, false if cache key and group already exist. */ public function add( $key, $data, $group = 'default', $expire = 0 ) { if ( wp_suspend_cache_addition() ) { return false; } if ( ! $this->is_valid_key( $key ) ) { return false; } if ( empty( $group ) ) { $group = 'default'; } $id = $key; if ( $this->multisite && ! isset( $this->global_groups[ $group ] ) ) { $id = $this->blog_prefix . $key; } if ( $this->_exists( $id, $group ) ) { return false; } return $this->set( $key, $data, $group, (int) $expire ); } /** * Adds multiple values to the cache in one call. * * @since 6.0.0 * * @param array $data Array of keys and values to be added. * @param string $group Optional. Where the cache contents are grouped. Default empty. * @param int $expire Optional. When to expire the cache contents, in seconds. * Default 0 (no expiration). * @return bool[] Array of return values, grouped by key. Each value is either * true on success, or false if cache key and group already exist. */ public function add_multiple( array $data, $group = '', $expire = 0 ) { $values = array(); foreach ( $data as $key => $value ) { $values[ $key ] = $this->add( $key, $value, $group, $expire ); } return $values; } /** * Replaces the contents in the cache, if contents already exist. * * @since 2.0.0 * * @see WP_Object_Cache::set() * * @param int|string $key What to call the contents in the cache. * @param mixed $data The contents to store in the cache. * @param string $group Optional. Where to group the cache contents. Default 'default'. * @param int $expire Optional. When to expire the cache contents, in seconds. * Default 0 (no expiration). * @return bool True if contents were replaced, false if original value does not exist. */ public function replace( $key, $data, $group = 'default', $expire = 0 ) { if ( ! $this->is_valid_key( $key ) ) { return false; } if ( empty( $group ) ) { $group = 'default'; } $id = $key; if ( $this->multisite && ! isset( $this->global_groups[ $group ] ) ) { $id = $this->blog_prefix . $key; } if ( ! $this->_exists( $id, $group ) ) { return false; } return $this->set( $key, $data, $group, (int) $expire ); } /** * Sets the data contents into the cache. * * The cache contents are grouped by the $group parameter followed by the * $key. This allows for duplicate IDs in unique groups. Therefore, naming of * the group should be used with care and should follow normal function * naming guidelines outside of core WordPress usage. * * The $expire parameter is not used, because the cache will automatically * expire for each time a page is accessed and PHP finishes. The method is * more for cache plugins which use files. * * @since 2.0.0 * @since 6.1.0 Returns false if cache key is invalid. * * @param int|string $key What to call the contents in the cache. * @param mixed $data The contents to store in the cache. * @param string $group Optional. Where to group the cache contents. Default 'default'. * @param int $expire Optional. Not used. * @return bool True if contents were set, false if key is invalid. */ public function set( $key, $data, $group = 'default', $expire = 0 ) { if ( ! $this->is_valid_key( $key ) ) { return false; } if ( empty( $group ) ) { $group = 'default'; } if ( $this->multisite && ! isset( $this->global_groups[ $group ] ) ) { $key = $this->blog_prefix . $key; } if ( is_object( $data ) ) { $data = clone $data; } $this->cache[ $group ][ $key ] = $data; return true; } /** * Sets multiple values to the cache in one call. * * @since 6.0.0 * * @param array $data Array of key and value to be set. * @param string $group Optional. Where the cache contents are grouped. Default empty. * @param int $expire Optional. When to expire the cache contents, in seconds. * Default 0 (no expiration). * @return bool[] Array of return values, grouped by key. Each value is always true. */ public function set_multiple( array $data, $group = '', $expire = 0 ) { $values = array(); foreach ( $data as $key => $value ) { $values[ $key ] = $this->set( $key, $value, $group, $expire ); } return $values; } /** * Retrieves the cache contents, if it exists. * * The contents will be first attempted to be retrieved by searching by the * key in the cache group. If the cache is hit (success) then the contents * are returned. * * On failure, the number of cache misses will be incremented. * * @since 2.0.0 * * @param int|string $key The key under which the cache contents are stored. * @param string $group Optional. Where the cache contents are grouped. Default 'default'. * @param bool $force Optional. Unused. Whether to force an update of the local cache * from the persistent cache. Default false. * @param bool|null $found Optional. Whether the key was found in the cache (passed by reference). * Disambiguates a return of false, a storable value. Default null. * @return mixed|false The cache contents on success, false on failure to retrieve contents. */ public function get( $key, $group = 'default', $force = false, &$found = null ) { if ( ! $this->is_valid_key( $key ) ) { return false; } if ( empty( $group ) ) { $group = 'default'; } if ( $this->multisite && ! isset( $this->global_groups[ $group ] ) ) { $key = $this->blog_prefix . $key; } if ( $this->_exists( $key, $group ) ) { $found = true; $this->cache_hits += 1; if ( is_object( $this->cache[ $group ][ $key ] ) ) { return clone $this->cache[ $group ][ $key ]; } else { return $this->cache[ $group ][ $key ]; } } $found = false; $this->cache_misses += 1; return false; } /** * Retrieves multiple values from the cache in one call. * * @since 5.5.0 * * @param array $keys Array of keys under which the cache contents are stored. * @param string $group Optional. Where the cache contents are grouped. Default 'default'. * @param bool $force Optional. Whether to force an update of the local cache * from the persistent cache. Default false. * @return array Array of return values, grouped by key. Each value is either * the cache contents on success, or false on failure. */ public function get_multiple( $keys, $group = 'default', $force = false ) { $values = array(); foreach ( $keys as $key ) { $values[ $key ] = $this->get( $key, $group, $force ); } return $values; } /** * Removes the contents of the cache key in the group. * * If the cache key does not exist in the group, then nothing will happen. * * @since 2.0.0 * * @param int|string $key What the contents in the cache are called. * @param string $group Optional. Where the cache contents are grouped. Default 'default'. * @param bool $deprecated Optional. Unused. Default false. * @return bool True on success, false if the contents were not deleted. */ public function delete( $key, $group = 'default', $deprecated = false ) { if ( ! $this->is_valid_key( $key ) ) { return false; } if ( empty( $group ) ) { $group = 'default'; } if ( $this->multisite && ! isset( $this->global_groups[ $group ] ) ) { $key = $this->blog_prefix . $key; } if ( ! $this->_exists( $key, $group ) ) { return false; } unset( $this->cache[ $group ][ $key ] ); return true; } /** * Deletes multiple values from the cache in one call. * * @since 6.0.0 * * @param array $keys Array of keys to be deleted. * @param string $group Optional. Where the cache contents are grouped. Default empty. * @return bool[] Array of return values, grouped by key. Each value is either * true on success, or false if the contents were not deleted. */ public function delete_multiple( array $keys, $group = '' ) { $values = array(); foreach ( $keys as $key ) { $values[ $key ] = $this->delete( $key, $group ); } return $values; } /** * Increments numeric cache item's value. * * @since 3.3.0 * * @param int|string $key The cache key to increment. * @param int $offset Optional. The amount by which to increment the item's value. * Default 1. * @param string $group Optional. The group the key is in. Default 'default'. * @return int|false The item's new value on success, false on failure. */ public function incr( $key, $offset = 1, $group = 'default' ) { if ( ! $this->is_valid_key( $key ) ) { return false; } if ( empty( $group ) ) { $group = 'default'; } if ( $this->multisite && ! isset( $this->global_groups[ $group ] ) ) { $key = $this->blog_prefix . $key; } if ( ! $this->_exists( $key, $group ) ) { return false; } if ( ! is_numeric( $this->cache[ $group ][ $key ] ) ) { $this->cache[ $group ][ $key ] = 0; } $offset = (int) $offset; $this->cache[ $group ][ $key ] += $offset; if ( $this->cache[ $group ][ $key ] < 0 ) { $this->cache[ $group ][ $key ] = 0; } return $this->cache[ $group ][ $key ]; } /** * Decrements numeric cache item's value. * * @since 3.3.0 * * @param int|string $key The cache key to decrement. * @param int $offset Optional. The amount by which to decrement the item's value. * Default 1. * @param string $group Optional. The group the key is in. Default 'default'. * @return int|false The item's new value on success, false on failure. */ public function decr( $key, $offset = 1, $group = 'default' ) { if ( ! $this->is_valid_key( $key ) ) { return false; } if ( empty( $group ) ) { $group = 'default'; } if ( $this->multisite && ! isset( $this->global_groups[ $group ] ) ) { $key = $this->blog_prefix . $key; } if ( ! $this->_exists( $key, $group ) ) { return false; } if ( ! is_numeric( $this->cache[ $group ][ $key ] ) ) { $this->cache[ $group ][ $key ] = 0; } $offset = (int) $offset; $this->cache[ $group ][ $key ] -= $offset; if ( $this->cache[ $group ][ $key ] < 0 ) { $this->cache[ $group ][ $key ] = 0; } return $this->cache[ $group ][ $key ]; } /** * Clears the object cache of all data. * * @since 2.0.0 * * @return true Always returns true. */ public function flush() { $this->cache = array(); return true; } /** * Removes all cache items in a group. * * @since 6.1.0 * * @param string $group Name of group to remove from cache. * @return true Always returns true. */ public function flush_group( $group ) { unset( $this->cache[ $group ] ); return true; } /** * Sets the list of global cache groups. * * @since 3.0.0 * * @param string|string[] $groups List of groups that are global. */ public function add_global_groups( $groups ) { $groups = (array) $groups; $groups = array_fill_keys( $groups, true ); $this->global_groups = array_merge( $this->global_groups, $groups ); } /** * Switches the internal blog ID. * * This changes the blog ID used to create keys in blog specific groups. * * @since 3.5.0 * * @param int $blog_id Blog ID. */ public function switch_to_blog( $blog_id ) { $blog_id = (int) $blog_id; $this->blog_prefix = $this->multisite ? $blog_id . ':' : ''; } /** * Resets cache keys. * * @since 3.0.0 * * @deprecated 3.5.0 Use WP_Object_Cache::switch_to_blog() * @see switch_to_blog() */ public function reset() { _deprecated_function( __FUNCTION__, '3.5.0', 'WP_Object_Cache::switch_to_blog()' ); // Clear out non-global caches since the blog ID has changed. foreach ( array_keys( $this->cache ) as $group ) { if ( ! isset( $this->global_groups[ $group ] ) ) { unset( $this->cache[ $group ] ); } } } /** * Echoes the stats of the caching. * * Gives the cache hits, and cache misses. Also prints every cached group, * key and the data. * * @since 2.0.0 */ public function stats() { echo '<p>'; echo "<strong>Cache Hits:</strong> {$this->cache_hits}<br />"; echo "<strong>Cache Misses:</strong> {$this->cache_misses}<br />"; echo '</p>'; echo '<ul>'; foreach ( $this->cache as $group => $cache ) { echo '<li><strong>Group:</strong> ' . esc_html( $group ) . ' - ( ' . number_format( strlen( serialize( $cache ) ) / KB_IN_BYTES, 2 ) . 'k )</li>'; } echo '</ul>'; } }