manifest / performance / block-visibility-edge-cache
Block Visibility Edge Cache
Handles VIP edge cache invalidation for blocks with time-based visibility settings.
★ 2stars
0forks
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/xwp/block-visibility-edge-cache/archive/refs/heads/main.zipAlso on Packagist as xwp/block-visibility-edge-cache:
composer require xwp/block-visibility-edge-cacheFrom the readme
Block Visibility Edge Cache
A WordPress plugin that integrates the Block Visibility plugin with WordPress.com VIP edge caching. It ensures that edge caches are automatically purged at the exact moment a block's visibility is scheduled to change.
How it Works
When using edge caching, page content is cached at the "edge" (servers closer to the user). Traditional "Date/Time" visibility rules in the Block Visibility plugin usually rely on PHP executing during the page load to decide whether to show or hide a block. With edge caching, PHP might not run for every request, leading to stale content being served even after a visibility transition should have occurred.
This plugin solves this by:
1. Parsing the blocks in a post when it is saved or published.
2. Calculating all future "transition" timestamps (when a block should appear or disappear) based on the Date/Time settings.
3. Scheduling background tasks using Action Scheduler to purge the post's edge cache at those specific timestamps.
Requirements
- PHP 8.4+
- WordPress 6.0+
- Block Visibility plugin
- Action Scheduler (bundled with the plugin or available via WooCommerce)
Installation
Via Composer (Recommended)
Manual
1. U