Warning
🚧 This project is still rather experimental.
Most probably not functional out of the box and definitely not ready for production.
This plugin provides cache handlers for WordPress, using Acorn framework based on Laravel fondation.
- Enables the two cache wrappers for WordPress using drop-ins.
- Object Cache (
object-cache.php
) - Advanced Page Cache (optional) (
advanced-cache.php
)
- Object Cache (
- Compatible with any driver supported by Laravel (including Redis, Memcached and Array).
- Adds handy WP-CLI commands.
- Targets modern software stacks.
-
Prepare your Composer file by adding custom paths.
Replace<wordpress-root/wp-content/>
with your WordPress content path,web/app/
with Bedrock.
See more info.{ "extra": { "dropin-paths": { "<wordpress-root/wp-content/>": [ "package:leocolomb/wp-acorn-cache:dropins/object-cache.php", "package:leocolomb/wp-acorn-cache:dropins/advanced-cache.php" ] } } }
-
Require the installer and allow its usage.
composer require koodimonni/composer-dropin-installer
-
Require the package in your Composer-managed WordPress instance.
composer require leocolomb/wp-acorn-cache
The WordPress Object Cache is used to save on trips to the database. The Object Cache stores all of the cache data to memory and makes the cache contents available by using a key, which is used to name and later retrieve the cache contents.
The cache driver must be setup as per Laravel documentation.
When using Bedrock as WordPress boilerplate, specify the driver
in your .env
file.
CACHE_DRIVER=redis
Object cache behavior can be configured with its appropriate config file, config/object-cache.php
.
Start by publishing the configuration file using Acorn.
wp acorn vendor:publish --provider="LeoColomb\WPAcornCache\Providers\AcornCacheServiceProvider"
With Page Caching, you cache the full output of a page (i.e. the response) and bypass WordPress entirely on subsequent requests.
Note: The page cache is using Symfony HttpCache. While quite efficient, you should prefer using an appropriate page cache tool, like Varnish, Nginx cache or a CDN.
Page cache is not activated per default with WordPress.
To enable page cache, define the constant WP_CACHE
to true
.
Page cache behavior can be configured with its appropriate config file, config/page-cache.php
.
Start by publishing the configuration file using Acorn.
wp acorn vendor:publish --provider="LeoColomb\WPAcornCache\Providers\AcornCacheServiceProvider"
ISC © Léo Colombaro