From 52a06d5ed4dfd0a2ff94231f6eb9afe57b417f1f Mon Sep 17 00:00:00 2001 From: Peter Wilson Date: Wed, 30 Jul 2025 23:03:30 +0000 Subject: [PATCH] Feeds: Cache RSS feeds in global transients. Moves the caching of RSS feeds requested via `fetch_feed()` from single site transients (`get|set|delete_transient()`) to global transients (`get|set|delete_site_transient()`). On multisite installs of WordPress, this replaces per site caching with the global multisite cache to allow a single cache to be shared between all sites. This reduces the amount of data stored in the database and improves performance of feeds when multiple sites are ingesting the same URL. Props rollybueno, spacedmonkey, peterwilsoncc. Fixes #63719. Built from https://develop.svn.wordpress.org/trunk@60524 git-svn-id: http://core.svn.wordpress.org/trunk@59860 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/class-wp-feed-cache-transient.php | 15 ++++++++------- wp-includes/version.php | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/wp-includes/class-wp-feed-cache-transient.php b/wp-includes/class-wp-feed-cache-transient.php index 734af641ca..2beeab69d2 100644 --- a/wp-includes/class-wp-feed-cache-transient.php +++ b/wp-includes/class-wp-feed-cache-transient.php @@ -12,6 +12,7 @@ * * @since 2.8.0 * @since 6.7.0 Now properly implements the SimplePie\Cache\Base interface. + * @since 6.9.0 Switched to Multisite's global cache via the `*_site_transient()` functions. */ #[AllowDynamicProperties] class WP_Feed_Cache_Transient implements SimplePie\Cache\Base { @@ -84,8 +85,8 @@ class WP_Feed_Cache_Transient implements SimplePie\Cache\Base { $data = $data->data; } - set_transient( $this->name, $data, $this->lifetime ); - set_transient( $this->mod_name, time(), $this->lifetime ); + set_site_transient( $this->name, $data, $this->lifetime ); + set_site_transient( $this->mod_name, time(), $this->lifetime ); return true; } @@ -97,7 +98,7 @@ class WP_Feed_Cache_Transient implements SimplePie\Cache\Base { * @return array Data for `SimplePie::$data`. */ public function load() { - return get_transient( $this->name ); + return get_site_transient( $this->name ); } /** @@ -108,7 +109,7 @@ class WP_Feed_Cache_Transient implements SimplePie\Cache\Base { * @return int Timestamp. */ public function mtime() { - return get_transient( $this->mod_name ); + return get_site_transient( $this->mod_name ); } /** @@ -119,7 +120,7 @@ class WP_Feed_Cache_Transient implements SimplePie\Cache\Base { * @return bool False if value was not set and true if value was set. */ public function touch() { - return set_transient( $this->mod_name, time(), $this->lifetime ); + return set_site_transient( $this->mod_name, time(), $this->lifetime ); } /** @@ -130,8 +131,8 @@ class WP_Feed_Cache_Transient implements SimplePie\Cache\Base { * @return true Always true. */ public function unlink() { - delete_transient( $this->name ); - delete_transient( $this->mod_name ); + delete_site_transient( $this->name ); + delete_site_transient( $this->mod_name ); return true; } } diff --git a/wp-includes/version.php b/wp-includes/version.php index c74069b9e1..fdcf76e326 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.9-alpha-60523'; +$wp_version = '6.9-alpha-60524'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.