From a82c344e99a0d4b769a10329a80914fb7271cf03 Mon Sep 17 00:00:00 2001 From: Robert Zondervan Date: Tue, 26 Sep 2023 13:05:19 +0200 Subject: [PATCH] Cache doctrine responses --- api/config/packages/doctrine.yaml | 10 ++++++++++ api/config/packages/framework.yaml | 1 + api/config/services.yaml | 9 +++++++++ 3 files changed, 20 insertions(+) diff --git a/api/config/packages/doctrine.yaml b/api/config/packages/doctrine.yaml index 89fbc13ba..4a17d0314 100644 --- a/api/config/packages/doctrine.yaml +++ b/api/config/packages/doctrine.yaml @@ -18,6 +18,16 @@ doctrine: dir: '%kernel.project_dir%/src/Entity' prefix: 'App\Entity' alias: App + metadata_cache_driver: + type: service + id: doctrine.system_cache_provider + query_cache_driver: + type: service + id: doctrine.system_cache_provider + result_cache_driver: + type: service + id: doctrine.result_cache_provider + dql: string_functions: regexp_replace: DoctrineExtensions\Query\Postgresql\RegexpReplace diff --git a/api/config/packages/framework.yaml b/api/config/packages/framework.yaml index 72c8e293d..23c913ea2 100644 --- a/api/config/packages/framework.yaml +++ b/api/config/packages/framework.yaml @@ -20,6 +20,7 @@ framework: cache: prefix_seed: commonground_gateway_cache app: cache.adapter.redis + system: cache.adapter.redis default_redis_provider: "redis://%env(REDIS_HOST)%:%env(int:REDIS_PORT)%" parameters: samesite: none diff --git a/api/config/services.yaml b/api/config/services.yaml index 7592c5f9f..1a4173e48 100644 --- a/api/config/services.yaml +++ b/api/config/services.yaml @@ -90,3 +90,12 @@ services: class: App\Logger\SessionDataProcessor tags: - { name: monolog.processor } + + doctrine.result_cache_provider: + class: Symfony\Component\Cache\DoctrineProvider + arguments: + - '@doctrine.result_cache_pool' + doctrine.system_cache_provider: + class: Symfony\Component\Cache\DoctrineProvider + arguments: + - '@doctrine.system_cache_pool'