OCMLABS/MODULE-WORDPRESS · CACHE MANAGEMENT

Cache Management

  • Magento
  • Adobe Commerce
  • Hyvä

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.

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.

TagWhat It Covers
WORDPRESS_POSTAll post data
WORDPRESS_POST_{id}A specific post by ID
WORDPRESS_CATEGORYAll category data
WORDPRESS_TAGAll tag data
WORDPRESS_MENUAll menu data
WORDPRESS_AUTHORAll author data
WORDPRESS_AUTHOR_{id}A specific author by ID

Webhook Purge Flow

When a post is updated in WordPress:

  1. The Content Bridge plugin’s save_post hook fires
  2. Plugin sends a signed POST to your Magento webhook URL (/wordpress/webhook/cachepurge)
  3. Magento verifies the HMAC-SHA256 signature in the X-OC-Bridge-Signature header
  4. Magento maps the object_type from the webhook payload to cache tags
  5. Tagged entries are purged from the module’s data cache
  6. Magento dispatches clean_cache_by_tags with the same tags, which purges the full page cache: the built-in cache directly, Varnish through a PURGE request for those tags
  7. The next request for an affected page is rendered with fresh content from WordPress

The webhook payload looks like:

JSON
{
  "event": "post_updated",
  "object_type": "post",
  "object_id": 42,
  "slug": "my-post-slug",
  "timestamp": 1700000000
}

Object type to cache tag mapping:

object_typeTags Purged
postWORDPRESS_POST, WORDPRESS_POST_{id}
pageWORDPRESS_POST, WORDPRESS_POST_{id}
categoryWORDPRESS_CATEGORY
post_tagWORDPRESS_TAG
nav_menuWORDPRESS_MENU

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

In this module