Cache Management
The Cache group controls how long WordPress API responses are cached in Magento and whether webhook-based cache purging is enabled.
Two caches hold WordPress content: the module’s data cache (the WordPress API responses, with the lifetimes below) and Magento’s full page cache (the rendered blog pages, built-in or Varnish). The cache purge webhook clears both, so an edit in WordPress shows on the next page load.
Admin path: Stores > Configuration > OCMLabs > WordPress Integration > Cache
Settings
Cache Lifetime (seconds)
How long post, tag, and general API responses are cached.
- Default: 1800 (30 minutes)
- Applies to: posts, tags, search results, author data, media
Category/Tag Cache Lifetime (seconds)
How long category and tag listing data is cached. Categories and tags change less frequently than posts, so a longer cache lifetime is appropriate.
- Default: 86400 (24 hours)
Enable Webhook Cache Purge
When enabled, Magento accepts POST requests from the WordPress plugin that trigger targeted cache purges when content changes in WordPress. Each purge clears the matching data cache entries and the full page cache entries (built-in or Varnish) for the pages that show the changed content.
- Default: No (disabled)
- Requires the Magento webhook URL to be entered in the WordPress plugin settings
Webhook Secret
Optional shared secret used to sign and verify cache purge webhooks (HMAC-SHA256, sent in the X-OC-Bridge-Signature header). Shown when Enable Webhook Cache Purge is set to Yes.
- Default: empty - webhooks are signed with the API key instead
- Set the same value in the WordPress plugin under Settings > OCMLabs Content Bridge for Magento > Webhook Secret
- Stored encrypted
- Added in 2.0.0
Cache Tags
The module uses Magento’s tagged cache system. Each cached item is tagged so it can be purged precisely when related content changes. Since 2.0.3, blog pages, the blog sidebar, the blog widgets and the WordPress menu carry the same tags in the full page cache (the X-Magento-Tags response header), so a purge also clears the cached pages that show the changed content. See Cache Tags for which blocks carry which tags.
| Tag | What It Covers |
|---|---|
WORDPRESS_ | All post data |
WORDPRESS_ | A specific post by ID |
WORDPRESS_ | All category data |
WORDPRESS_ | All tag data |
WORDPRESS_ | All menu data |
WORDPRESS_ | All author data |
WORDPRESS_ | A specific author by ID |
Webhook Purge Flow
When a post is updated in WordPress:
- The Content Bridge plugin’s
save_posthook fires - Plugin sends a signed POST to your Magento webhook URL (
/wordpress/webhook/cachepurge) - Magento verifies the HMAC-SHA256 signature in the
X-OC-Bridge-Signatureheader - Magento maps the
object_typefrom the webhook payload to cache tags - Tagged entries are purged from the module’s data cache
- Magento dispatches
clean_cache_by_tagswith the same tags, which purges the full page cache: the built-in cache directly, Varnish through a PURGE request for those tags - The next request for an affected page is rendered with fresh content from WordPress
The webhook payload looks like:
{
"event": "post_updated",
"object_type": "post",
"object_id": 42,
"slug": "my-post-slug",
"timestamp": 1700000000
} Object type to cache tag mapping:
object_type | Tags Purged |
|---|---|
post | WORDPRESS_, WORDPRESS_ |
page | WORDPRESS_, WORDPRESS_ |
category | WORDPRESS_ |
post_ | WORDPRESS_ |
nav_ | WORDPRESS_ |
Cron Jobs
Two cron jobs run automatically:
- WarmCache - pre-warms the post cache by fetching the first page of posts every 4 hours
- SyncCategories - syncs category data daily at 3:00 AM
See Cron Jobs reference for full details.
See also
Related pages
- How the plugin signs and sends cache-purge webhooks
- Every cache tag constant and how to purge one by hand
- Request and cache key flow for listings, single posts and webhook purges
- Webhook purge returns 403 and other common failures