Skip to content
Snippets Groups Projects
Commit a16074f5 authored by jurgenhaas's avatar jurgenhaas
Browse files

ansible-inventories/gentner#158 New Redis settings, optional at this time

parent 949f78b9
Branches
No related tags found
No related merge requests found
......@@ -60,7 +60,7 @@ $config_directories['{{ directory }}'] = 'sites/{{ item.shortname|default("defau
{% endfor %}
// Set redis configuration.
if (file_exists('modules/contrib/redis/redis.info.yml')) {
if (file_exists('modules/contrib/redis/redis.info.yml') && extension_loaded('redis')) {
// Set Redis as the default backend for any cache bin not otherwise specified.
$settings['redis.connection']['interface'] = 'PhpRedis';
$settings['cache']['default'] = 'cache.backend.redis';
......@@ -93,7 +93,7 @@ if (file_exists('modules/contrib/redis/redis.info.yml')) {
],
'cache.backend.redis' => [
'class' => 'Drupal\redis\Cache\CacheBackendFactory',
'arguments' => ['@redis.factory', '@cache_tags_provider.container'],
'arguments' => ['@redis.factory', '@cache_tags_provider.container'{% if item.redis_serialize|default(false) %}, '@serialization.phpserialize'{% endif %}],
],
'cache.container' => [
'class' => '\Drupal\redis\Cache\PhpRedis',
......@@ -104,6 +104,11 @@ if (file_exists('modules/contrib/redis/redis.info.yml')) {
'class' => 'Drupal\redis\Cache\RedisCacheTagsChecksum',
'arguments' => ['@redis.factory'],
],
{% if item.redis_serialize|default(false) %}
'serialization.phpserialize' => [
'class' => 'Drupal\Component\Serialization\PhpSerialize',
],
{% endif %}
],
];
......@@ -114,6 +119,18 @@ if (file_exists('modules/contrib/redis/redis.info.yml')) {
{% else %}
$settings['cache_prefix'] = '{{ item.shortname|default("default") }}_';
{% endif %}
{% if drupal.version_8_1|default(false) %}
// Drupal 8.1 has a bug where certain special caches that should use the
// APCu cache if available will not do so if a non-SQL default is specified.
// The following lines explicitly force those cache bins to use the correct
// cache backend. This block may be removed in Drupal 8.2.
// @see https://www.drupal.org/node/2753989
$settings['cache']['bins']['bootstrap'] = 'cache.backend.chainedfast';
$settings['cache']['bins']['discovery'] = 'cache.backend.chainedfast';
$settings['cache']['bins']['config'] = 'cache.backend.chainedfast';
$settings['cache']['bins']['static'] = 'cache.backend.memory';
{% endif %}
}
if (file_exists(__DIR__ . '/settings.local.php')) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment