From 023bcf836f54c28db70ee7540952b3fbe3f9bfd1 Mon Sep 17 00:00:00 2001 From: Seamus Lee Date: Thu, 11 Jul 2019 08:19:18 +1000 Subject: [PATCH] Ensure recently converted groups cache matches previous behabiour my setting withArray as fast for it Add in code comment as per Eileen --- Civi/Core/Container.php | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/Civi/Core/Container.php b/Civi/Core/Container.php index 533e8d8b94..853299498b 100644 --- a/Civi/Core/Container.php +++ b/Civi/Core/Container.php @@ -159,14 +159,20 @@ class Container { 'groups' => 'contact groups', ]; foreach ($basicCaches as $cacheSvc => $cacheGrp) { + $definitionParams = [ + 'name' => $cacheGrp, + 'type' => ['*memory*', 'SqlGroup', 'ArrayCache'], + ]; + // For Caches that we don't really care about the ttl for and/or maybe accessed + // fairly often we use the fastArrayDecorator which improves reads and writes, these + // caches should also not have concurrency risk. + $fastArrayCaches = ['groups']; + if (in_array($cacheSvc, $fastArrayCaches)) { + $definitionParams['withArray'] = 'fast'; + } $container->setDefinition("cache.{$cacheSvc}", new Definition( 'CRM_Utils_Cache_Interface', - [ - [ - 'name' => $cacheGrp, - 'type' => ['*memory*', 'SqlGroup', 'ArrayCache'], - ], - ] + [$definitionParams] ))->setFactory('CRM_Utils_Cache::create'); } -- 2.25.1