Caching
Erscheinungsbild
Drupal Caching optimieren und verbessern.
Redis
Redis bei Drupal einrichten
Redis caching bei Drupal einrichten
composer require drupal/redis
drush en -y redis
sync PROJEKT
drush @live en -y redis
folgendes beiweb/sites/default/service.php ergänzen:
// Cusotm Redis Caching (size)
// composer require predis/predis
//
$settings['redis.connection']['interface'] = 'PhpRedis'; // Can be "Predis".
$settings['redis.connection']['host'] = '127.0.0.1'; // Your Redis instance hostname.
$settings['redis.settings']['perm_ttl'] = 1209600; // 14 days
$settings['cache']['default'] = 'cache.backend.redis';
$settings['queue_default'] = 'queue.redis';
$settings['redis.connection']['persistent'] = TRUE; // true
$settings['redis_compress_length'] = 100; // 100
$settings['redis_compress_level'] = 6; // 6
$settings['redis.connection']['base'] = 6; // 12
$settings['container_yamls'][] = $app_root . '/' . $site_path . '/redis.services.yml';
Datei: web/sites/default/redis.services.yml anlegen
# This file contains example services overrides.
#
# Enable with this line in settings.php
# $settings['container_yamls'][] = 'modules/redis/example.services.yml';
#
# Or copy & paste the desired services into sites/default/services.yml.
#
# Note that the redis module must be enabled for this to work.
services:
# Cache tag checksum backend. Used by redis and most other cache backend
# to deal with cache tag invalidations.
cache_tags.invalidator.checksum:
class: Drupal\redis\Cache\RedisCacheTagsChecksum
arguments: ['@redis.factory']
tags:
- { name: cache_tags_invalidator }
# Replaces the default lock backend with a redis implementation.
lock:
class: Drupal\Core\Lock\LockBackendInterface
factory: ['@redis.lock.factory', get]
# Replaces the default persistent lock backend with a redis implementation.
lock.persistent:
class: Drupal\Core\Lock\LockBackendInterface
factory: ['@redis.lock.factory', get]
arguments: [true]
# Replaces the default flood backend with a redis implementation.
flood:
class: Drupal\Core\Flood\FloodInterface
factory: ['@redis.flood.factory', get]
=APCu
php -r "apcu_clear_cache();" - Cache Leeren
Memcahce