From 76303d3a3bb0b107cb70ddcf9d002997f3497b4b Mon Sep 17 00:00:00 2001 From: Dekart Deploy Bot Date: Fri, 17 Jul 2026 16:09:56 +0000 Subject: [PATCH] feat: add MU-plugin for cache backend auto-detection + versioned cache invalidation - Auto-detects Memcached/Redis via fsockopen - Versioned cache key helper (my_cache_key) - Auto-flush on option/post/CF changes (no manual wp cache flush) - WP-CLI command: wp dekart cache-flush - Admin bar shows backend + cache version --- .../mu-plugins/object-cache-bootstrap.php | 173 ++++++++++++++++-- 1 file changed, 158 insertions(+), 15 deletions(-) diff --git a/wp-content/mu-plugins/object-cache-bootstrap.php b/wp-content/mu-plugins/object-cache-bootstrap.php index faddc58..e22f05b 100644 --- a/wp-content/mu-plugins/object-cache-bootstrap.php +++ b/wp-content/mu-plugins/object-cache-bootstrap.php @@ -1,21 +1,164 @@ add_node( array( + 'id' => 'dekart-cache-status', + 'title' => sprintf( + 'Cache: %s | v%s', + $backend_label, + my_cache_version() + ), + 'href' => '#', + ) ); +}, 100 ); + +// ============================================================ +// 8. WP-CLI: командa для сброса версии +// ============================================================ + +if ( defined( 'WP_CLI' ) && WP_CLI ) { + WP_CLI::add_command( 'dekart cache-flush', function () { + my_cache_bump_version(); + WP_CLI::success( 'Cache version bumped. All versioned cache keys are invalidated.' ); + } ); }