title: How to use ApcuCache with Symfony, Doctrine ORM and DoctrineCacheBundle
body: <p>before i was stuck with this problem the project was running on PHP5.6 on SF2.6.</p>
  
  <p>now im using PHP7.1.20 with SF2.8. i installed apcu along with apcu_bc inside my docker container and enabled the apcu php module.</p>
  
  <p>now the error is:</p>
  
  <pre><code>UndefinedFunctionException in ApcCache.php line 35:
  Attempted to call function "apc_exists" from the global namespace.
  </code></pre>
  
  <p>when i change the actual function calls inside of the loaded ApcCache-Class from apc_ to apcu_ everything works fine.</p>
  
  <p>inside Doctrine\Common\Cache are both classes, the ApcCache- and the ApcuCache-Class. i dont know how i can tell doctrine ORM/CacheBundle to use the ApcuCache-Class instead of the Apc one.</p>
  
  <p>Doctrine Config:</p>
  
  <pre><code>doctrine:
      dbal:
          default_connection: default
          connections:
              default:
                  driver:   "%database_driver%"
                  host:     "%database_host%"
                  port:     "%database_port%"
                  dbname:   "%database_name%"
                  user:     "%database_user%"
                  password: "%database_password%"
                  charset:  UTF8
                  persistent: true
                  wrapper_class: 'Facile\DoctrineMySQLComeBack\Doctrine\DBAL\Connection'
                  driver_class: 'Facile\DoctrineMySQLComeBack\Doctrine\DBAL\Driver\PDOMySql\Driver'
                  server_version: '5.7'
                  options:
                      x_reconnect_attempts: 3
              jato:
                  driver:   "%database_jato_driver%"
                  host:     "%database_jato_host%"
                  port:     "%database_jato_port%"
                  dbname:   "%database_jato_name%"
                  user:     "%database_jato_user%"
                  password: "%database_jato_password%"
                  charset:  UTF8
                  persistent: true
                  server_version: '5.7'
  
              drupal:
                  driver:   "%database_drupal_driver%"
                  host:     "%database_drupal_host%"
                  port:     "%database_drupal_port%"
                  dbname:   "%database_drupal_name%"
                  user:     "%database_drupal_user%"
                  password: "%database_drupal_password%"
                  charset:  UTF8
                  persistent: true
                  server_version: '5.7'
  
          types:
              json: Sonata\Doctrine\Types\JsonType
  
      orm:
          auto_generate_proxy_classes: "%kernel.debug%"
          default_entity_manager: default
          entity_managers:
              default:
                  connection: default
                  mappings:
                      SonataMediaBundle: ~
                      ApplicationSonataMediaBundle: ~
                      XFrontendBundle: ~
                  query_cache_driver:
                      type: service
                      id: doctrine_cache.providers.chain_cache
                  metadata_cache_driver:
                      type: service
                      id: doctrine_cache.providers.chain_cache
                  result_cache_driver:
                      type: service
                      id: doctrine_cache.providers.chain_cache
  
              jato:
                  connection: jato
                  mappings:
                      XBackendBundle: ~
                  query_cache_driver: array
                  metadata_cache_driver: array
                  result_cache_driver: array
              drupal:
                  connection: drupal
  </code></pre>
  
  <p>DoctrineCacheBundle Config:</p>
  
  <pre><code>doctrine_cache:
      providers:
          chain_cache:
              chain:
                  providers: [array_cache, apc_cache]
          apc_cache:
              type: apc
          array_cache:
              type: array
  </code></pre>
  
  <p>inside the cached service container (app/cache/prod/appProdProjectContainer.php) i can find following information:</p>
  
  <pre><code>'doctrine_cache.providers.apc_cache' =&gt; 'getDoctrineCache_Providers_ApcCacheService',
  </code></pre>
  
  <p>followed by</p>
  
  <pre><code>/*
       * Gets the public 'doctrine_cache.providers.apc_cache' shared service.
       *
       * @return \Doctrine\Common\Cache\ApcCache
       */
      protected function getDoctrineCache_Providers_ApcCacheService()
      {
          return $this-&gt;services['doctrine_cache.providers.apc_cache'] = new \Doctrine\Common\Cache\ApcCache();
      }
  </code></pre>
  
  <p>and </p>
  
  <pre><code> 'validator.mapping.cache.apc.class' =&gt; 'Symfony\\Component\\Validator\\Mapping\\Cache\\ApcCache',
  </code></pre>
  
  <p>and </p>
  
  <pre><code>'doctrine_cache.apc.class' =&gt; 'Doctrine\\Common\\Cache\\ApcCache',
  'doctrine.orm.cache.apc.class' =&gt; 'Doctrine\\Common\\Cache\\ApcCache',
  </code></pre>
  
  <p>what do i need to configure or update etc to achieve that only the ApcuCache-Class gets used instead of Apc. </p>
  
  <p>additional composer infos:</p>
  
  <pre><code>doctrine/cache                           v1.8.0
  doctrine/annotations                     v1.6.0             
  doctrine/cache                           v1.8.0             
  doctrine/collections                     v1.5.0             
  doctrine/common                          v2.9.0             
  doctrine/dbal                            v2.4.5             
  doctrine/doctrine-bundle                 1.6.13             
  doctrine/doctrine-cache-bundle           dev-master 
  doctrine/event-manager                   v1.0.0             
  doctrine/inflector                       v1.3.0             
  doctrine/instantiator                    1.1.0              
  doctrine/lexer                           v1.0.1             
  doctrine/orm                             v2.4.8             
  doctrine/persistence                     v1.0.1             
  doctrine/reflection                      v1.0.0  
  
  symfony/assetic-bundle                   v2.8.2             
  symfony/monolog-bundle                   v2.12.1           
  symfony/polyfill-apcu                    v1.9.0             
  symfony/polyfill-ctype                   v1.9.0             
  symfony/polyfill-intl-icu                v1.9.0             
  symfony/polyfill-mbstring                v1.9.0             
  symfony/polyfill-php54                   v1.9.0             
  symfony/polyfill-php55                   v1.9.0             
  symfony/polyfill-php56                   v1.9.0             
  symfony/polyfill-php70                   v1.9.0             
  symfony/polyfill-util                    v1.9.0             
  symfony/security-acl                     v3.0.1             
  symfony/swiftmailer-bundle               v2.6.7             
  symfony/symfony                          v2.8.45
  
  sonata-project/admin-bundle              3.39.0             
  sonata-project/block-bundle              3.12.1             
  sonata-project/cache                     2.0.1              
  sonata-project/core-bundle               3.11.2             
  sonata-project/datagrid-bundle           2.3.1              
  sonata-project/doctrine-extensions       1.0.2              
  sonata-project/doctrine-orm-admin-bundle 3.4.2              
  sonata-project/easy-extends-bundle       2.5.0              
  sonata-project/exporter                  1.9.1              
  sonata-project/formatter-bundle          3.5.0              
  sonata-project/intl-bundle               2.5.0              
  sonata-project/jquery-bundle             1.10.2             
  sonata-project/markitup-bundle           2.1.0              
  sonata-project/media-bundle              3.15.0 
  </code></pre>
  
  <p>container debug information:</p>
  
  <pre><code>Information for Service "doctrine_cache.providers.apc_cache"
  ============================================================
  
   ------------------ ------------------------------------
    Option             Value
   ------------------ ------------------------------------
    Service ID         doctrine_cache.providers.apc_cache
    Class              Doctrine\Common\Cache\ApcCache
    Tags               -
    Scope              container
    Public             yes
    Synthetic          no
    Lazy               no
    Synchronized       no
    Abstract           no
    Autowired          no
    Autowiring Types   -
   ------------------ ------------------------------------    
  </code></pre>
  
  <p>i guess this is the right service which i have to configure to use the ApcuCache-Class over the actual ApcCache-Class.</p>
  
  <p>thanks guys help is much appreciated.</p>