X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=Civi%2FCore%2FContainer.php;h=853299498b870c9a89287d537d39df6ed8c377a9;hb=e38990f97174da2e8c848c2f3f1d0a531f43bba7;hp=9ce531d1bb776fc3ad3994afe6e9c98a2435afdf;hpb=65e7186ec68f7f26abb20f19145696af2012e14f;p=civicrm-core.git diff --git a/Civi/Core/Container.php b/Civi/Core/Container.php index 9ce531d1bb..853299498b 100644 --- a/Civi/Core/Container.php +++ b/Civi/Core/Container.php @@ -156,19 +156,38 @@ class Container { 'checks' => 'checks', 'session' => 'CiviCRM Session', 'long' => 'long', + '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'); } + // PrevNextCache cannot use memory or array cache at the moment because the + // Code in CRM_Core_BAO_PrevNextCache assumes that this cache is sql backed. + $container->setDefinition("cache.prevNextCache", new Definition( + 'CRM_Utils_Cache_Interface', + [ + [ + 'name' => 'CiviCRM Search PrevNextCache', + 'type' => ['SqlGroup'], + ], + ] + ))->setFactory('CRM_Utils_Cache::create'); + $container->setDefinition('sql_triggers', new Definition( 'Civi\Core\SqlTriggers', [] @@ -179,6 +198,11 @@ class Container { [] )); + $container->setDefinition('themes', new Definition( + 'Civi\Core\Themes', + [] + )); + $container->setDefinition('pear_mail', new Definition('Mail')) ->setFactory('CRM_Utils_Mail::createMailer');