Fast APCu Object Cache is a high-performance, lightweight APCu object cache built for large-scale WordPress and WooCommerce projects. It acts as a highly optimized drop-in replacement for the native WordPress in-memory runtime cache, minimizing database load and maximizing execution speed through persistent backend storage.
- Natively leverages the PHP
apcu_extension for ultra-fast, persistent object caching. - Reduces heavy database queries by reliably maintaining options, transients, and object metadata in memory.
- Safely handles APCu memory exhaustion by gracefully deleting keys when storage fails, forcing fresh database reads instead of serving stale data.
- Implements an internal runtime cache array to prevent redundant APCu round-trips during a single page load.
- Automatically trims the runtime cache limit using an efficient, key-preserving slice mechanism to prevent memory exhaustion and array key corruption on massive bulk operations.
- Strictly adheres to functional and procedural paradigms native to WordPress core.
- Fully supports global cache groups for shared data across networks.
- Natively handles non-persistent groups (such as
countsandplugins) by enforcing that they remain exclusively in the runtime cache and never hit APCu.
- Provides full WordPress Multisite support.
- Automatically isolates cache keys using the blog ID prefix to prevent data bleeding across the network.
- Context-aware key prefixing ensures CLI, Cron, and web requests all target the identical caching environment.
- Utilizes native
APCUIteratorobjects directly for safe, hash-pointer-accurate group flushing without skipping items. - Flushes only the keys belonging to the specific WordPress installation using dynamic key salts, preventing conflicts with other applications or sites running on the same server.
- Install the APCu PHP extension on your web server.
- Copy the
object-cache.phpfile directly into yourwp-content/directory. - WordPress will automatically detect the drop-in and initialize the persistent cache.
All configuration is automatic, but you can explicitly define your cache salt in wp-config.php to guarantee prefix consistency across different execution
environments (like WP-CLI).
Author: Andrii Toniievych
Contact: toniyevych@gmail.com
Feel free to contact me if you have any questions.
- Fork this repository
- Commit your changes
- Push it to the branch
- Create the new pull request
Twee is released under the MIT Public License.
Note: The "About" section in README.md and the author (@author) notice in the file-headers shall not be edited or deleted without permission. Thank you!