Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
drupal
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Ansible
Roles
drupal
Commits
3a34540d
Commit
3a34540d
authored
8 years ago
by
jurgenhaas
Browse files
Options
Downloads
Patches
Plain Diff
ansible-inventories/arocom#192 Redis Support for Drupal 8
parent
ff0277b6
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
templates/d8_settings.php
+57
-0
57 additions, 0 deletions
templates/d8_settings.php
with
57 additions
and
0 deletions
templates/d8_settings.php
+
57
−
0
View file @
3a34540d
...
...
@@ -59,6 +59,63 @@ $config_directories['{{ directory }}'] = 'sites/{{ item.shortname|default("defau
{{
line
}}
{
%
endfor
%
}
// Set redis configuration.
if
(
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'
;
$settings
[
'redis.connection'
][
'host'
]
=
'127.0.0.1'
;
// Apply changes to the container configuration to better leverage Redis.
// This includes using Redis for the lock and flood control systems, as well
// as the cache tag checksum. Alternatively, copy the contents of that file
// to your project-specific services.yml file, modify as appropriate, and
// remove this line.
$settings
[
'container_yamls'
][]
=
'modules/contrib/redis/example.services.yml'
;
// Allow the services to work before the Redis module itself is enabled.
$settings
[
'container_yamls'
][]
=
'modules/contrib/redis/redis.services.yml'
;
// Manually add the classloader path, this is required for the container cache bin definition below
// and allows to use it without the redis module being enabled.
$class_loader
->
addPsr4
(
'Drupal\\redis\\'
,
'modules/contrib/redis/src'
);
// Use redis for container cache.
// The container cache is used to load the container definition itself, and
// thus any configuration stored in the container itself is not available
// yet. These lines force the container cache to use Redis rather than the
// default SQL cache.
$settings
[
'bootstrap_container_definition'
]
=
[
'parameters'
=>
[],
'services'
=>
[
'redis.factory'
=>
[
'class'
=>
'Drupal\redis\ClientFactory'
,
],
'cache.backend.redis'
=>
[
'class'
=>
'Drupal\redis\Cache\CacheBackendFactory'
,
'arguments'
=>
[
'@redis.factory'
,
'@cache_tags_provider.container'
],
],
'cache.container'
=>
[
'class'
=>
'\Drupal\redis\Cache\PhpRedis'
,
'factory'
=>
[
'@cache.backend.redis'
,
'get'
],
'arguments'
=>
[
'container'
],
],
'cache_tags_provider.container'
=>
[
'class'
=>
'Drupal\redis\Cache\RedisCacheTagsChecksum'
,
'arguments'
=>
[
'@redis.factory'
],
],
],
];
// Set a fixed prefix so that all requests share the same prefix, even if
// on different domains.
{
%
if
drupal
.
jail
is
defined
%
}
$settings
[
'cache_prefix'
]
=
'{{ drupal.jail.name }}_{{ item.shortname|default("default") }}_'
;
{
%
else
%
}
$settings
[
'cache_prefix'
]
=
'{{ item.shortname|default("default") }}_'
;
{
%
endif
%
}
}
if
(
file_exists
(
__DIR__
.
'/settings.local.php'
))
{
include
__DIR__
.
'/settings.local.php'
;
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment