Skip to content

v1.2.0

Choose a tag to compare

@hostney hostney released this 12 Aug 00:15
· 12 commits to master since this release

Object caching now works with Redis as well as Memcached, and the site figures out which one it is on by itself.

This release also contains v1.1.0, which added Memcached object caching and was never published here. Upgrading from v1.0.0 gets you both.

What's new

Redis object caching

The object cache drop-in speaks to Redis or Memcached. Which one it uses is decided per request, by probing for each engine's socket and connecting to whichever answers.

That is the whole mechanism, and it is why switching engines in the Hostney control panel needs no action on the site: the panel stops one engine and starts the other, and the next PHP request finds the new socket and connects to it. Nothing to reconfigure, no file to edit, no constant to set.

A cache that cannot take the site down

If neither engine answers, the drop-in falls back to a non-persistent in-memory array for that request. The site keeps serving; it just stops caching between requests until the socket is back.

A socket that accepts a connection is not a server that answers, so the drop-in checks for a real response rather than trusting the connect, and it uses a short timeout throughout - both engines are on the same machine, so a slow one is a broken one.

Fixed: wp_cache_supports( 'flush_group' ) now reports false

It reported true while only clearing the in-process array. That told WordPress a group flush had invalidated persistent entries when it had not, so anything relying on wp_cache_flush_group() could read stale data back out of the object cache. Reporting false makes WordPress fall back to a path that actually works.

Internal

Drop-in management moved out of the Memcached class. It is one file serving either engine, rather than one engine's class owning the single object-cache.php slot that both need.

Features

  • Automatic nginx cache purge on content changes - posts, pages, custom post types, taxonomies, comments
  • Smart URL collection - purges permalink, homepage, RSS feed, sitemap, and related archives
  • Deduplication and batching - multiple changes in a single request are collected and deduplicated
  • Batch overflow protection - falls back to full cache clear when more than 15 URLs are queued
  • Gutenberg debounce - handles concurrent save requests without duplicate purges
  • Redis or Memcached object cache management, detected at runtime
  • Admin page with status overview, manual purge button, and activity log
  • Admin bar and post editor purge buttons

Requirements

  • WordPress 5.0+ (tested to 6.9)
  • PHP 7.4+
  • Hostney hosting (nginx caching with OpenResty/Lua)
  • For object caching: the redis or memcached PHP extension, whichever engine the account runs. Both ship in the Hostney PHP images.

Upgrading

Sites hosted on Hostney are updated automatically - no action needed.

Anywhere else, replace the plugin folder as usual. The drop-in is rewritten on activation and keeps the same marker, so an existing wp-content/object-cache.php from an earlier version is recognised and replaced rather than left in place.