2017 © Pedro Peláez
 

drupal-module cache_split

image

derhasi/cache_split

  • Monday, October 9, 2017
  • by derhasi
  • Repository
  • 1 Watchers
  • 0 Stars
  • 1,969 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 6 % Grown

The README.md

cache_split

A cache backend for Drupal to split cache items in separate backends., (*1)

Installation

  1. composer require derhasi/cache_split:dev-master
  2. Enable cache_split module (e.g. drush en cache_split)
  3. Change the cache backend for your bin (e.g. render) in your settings.php
<?php
$settings['cache']['bins']['render'] = 'cache.backend.split';
?>
  1. Add split configuration for your bin to the settings.php:
<?php
$settings['cache_split']['render'] = [
  //..
];

See Configuration below for details., (*2)

Configuration

The configuration for a cache bin has to be defined in the settings.php:, (*3)

<?php
$settings['cache_split']['NAME_OF_CACHE_BIN'] = [
  //..
];

Matcher definition

Each bin can hold multiple matcher definitions, each may consists of:, (*4)

  • backend: Name of the cache backend service to use (e.g. cache.backend.database). If not given it defaults to the key of the definition.
  • includes: Array of cid patterns this backend should be used for. If this is empty all cids are included (except those excluded by excludes).
  • excludes: Array of cid patterns this backend should not be used for

Wildcard syntax

A cid pattern may use * to match any number of arbitrary characters., (*5)

Fallback cache backend

A fallback backend can be defined by simply omitting includes and excludes or leaving them empty., (*6)

Make sure the fallback backend is defined last, so the other definitions are considered., (*7)

In case no fallback backend is specified, cache.backend.database is set as default., (*8)

Example

<?php
$settings['cache_split'] = [
  // Splits render cache in multiple backends.
  'render' => [
    // Do not cache render results for paragraphs, as they are only rendered in
    // context of the host entity.
    [
      'backend' => 'cache.backend.null',
      'includes' => [
        'entity_view:paragraph:*'
      ],
      'excludes' => [],
    ],
    // Falls back to database backend.
    [
      'backend' => 'cache.backend.database',
    ],
  ],
];
?>

The Versions

09/10 2017

dev-8.x-1.x

dev-8.x-1.x

  Sources   Download

GPLv3

08/03 2017

dev-master

9999999-dev

  Sources   Download

GPLv3

08/03 2017

1.0.0-alpha1

1.0.0.0-alpha1

  Sources   Download

GPLv3