PluginProbe
xSpeed Cache: AI-Powered Performance Hub with MCP, Caching & CDN / 1.3.7
xSpeed Cache: AI-Powered Performance Hub with MCP, Caching & CDN v1.3.7
1.3.7 1.3.6 1.3.5 1.3.4 1.3.3 1.3.2 1.3.1 1.3.0 1.2.4 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 All 33 releases
← All changes | includes/class-rest-cache.php +10 -5 1.0.6 → 1.3.7 View file →
@@ -15,9 +15,12 @@
15 15 * safety rules (GET-only, no auth context, 2xx, route allow-list) and
16 16 * the storage; the add-on owns policy (which routes, how long).
17 17 *
18 18 * Storage: one JSON file per entry under XSPEED_CACHE_DIR/rest/, keyed
19 - * by md5(route + sorted query params). Purged by Cache::purge_all().
19 + * by md5(blog bucket + route + sorted query params). The blog namespace is
20 + * part of the filename so same-route requests cannot collide on multisite.
21 + * Purged by Cache::purge_local() — the whole bucket at once, every blog
22 + * with it, since the namespace is inside the md5 and not globbable.
20 23 *
21 24 * @package XSpeed
22 25 */
23 26
@@ -217,9 +220,9 @@
217 220 return XSPEED_CACHE_DIR . '/' . self::SUBDIR;
218 221 }
219 222
220 223 /**
221 - * Cache file for a request — md5(route + sorted query params), so
224 + * Cache file for a request — md5(blog bucket + route + sorted query params), so
222 225 * /wp/v2/posts?per_page=5 and ?per_page=10 are distinct but param
223 226 * order doesn't matter. POST body is irrelevant (GET-only).
224 227 *
225 228 * @param \WP_REST_Request $request The request.
@@ -242,15 +245,17 @@
242 245 unset( $parsed['rest_route'] );
243 246 ksort( $parsed );
244 247 $qs = wp_json_encode( $parsed );
245 248 }
246 - $key = md5( (string) $request->get_route() . '?' . $qs );
249 + $key = md5( Cache::current_host_dir() . '|' . (string) $request->get_route() . '?' . $qs );
247 250 return self::dir() . '/' . $key . '.json';
248 251 }
249 252
250 253 /**
251 - * Delete every REST cache entry. Called by Cache::purge_all(). Returns
252 - * the count removed.
254 + * Delete every REST cache entry — the entire bucket, all blogs, because
255 + * the blog namespace lives inside the md5 rather than in a path segment.
256 + * Called by Cache::purge_local() and by purge_type( 'rest' ). Returns the
257 + * count removed.
253 258 */
254 259 public static function purge(): int {
255 260 $dir = self::dir();
256 261 if ( ! is_dir( $dir ) ) {