Skip to content

💽 A WordPress cache manager powered by Laravel through Acorn.

License

Notifications You must be signed in to change notification settings

LeoColomb/wp-acorn-cache

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Acorn Cache for WordPress

A cache manager powered by Laravel through Acorn.

Build Status Packagist

Warning

🚧 This project is still rather experimental.
Most probably not functional out of the box and definitely not ready for production.

About

This plugin provides cache handlers for WordPress, using Acorn framework based on Laravel fondation.

  • Enables the two cache wrappers for WordPress using drop-ins.
  • Compatible with any driver supported by Laravel (including Redis, Memcached and Array).
  • Adds handy WP-CLI commands.
  • Targets modern software stacks.

Usage

  • 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

Object 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.

See WordPress documentation.

Driver (recommended)

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

Configuration (optional)

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"

Page Cache

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.

Activation (optional)

Page cache is not activated per default with WordPress. To enable page cache, define the constant WP_CACHE to true.

Configuration (optional)

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"

License

ISC © Léo Colombaro