Update: see the bottom of the post
(this was published when we used SF 2.3, now we are at 2.7.0)
We have several Symfony applications running on our server, but we seem to get cache pollution on all sites due to all ORM cache entries of the doctrine with the prefix "sf2".
Distracted in the last 30 minutes, you will find that this is not an easy solution.
The first ones suggested using ProjectConfiguration.class.php - but that seems to be something like Symfony 1.
The next possible solution was to use the ApcUniversalClassLoader class (according to this question on SO: Multiple Symfony2 Sites using the APC cache ).
The problem is that our installation uses the composer for autoload, so we cannot just use the code in accordance with this example.
The APC caching class is excellent, you can set the key in the front controller, but it does not set the key for the doctrine cache.
Does anyone have any thoughts since we currently need to disable APC for the doctrine on all but the first application.
FrontController:
<?php
use Symfony\Component\ClassLoader\ApcClassLoader;
use Symfony\Component\HttpFoundation\Request;
require_once __DIR__.'/../app/bootstrap.php.cache';
$loader = new ApcClassLoader('app_1', $loader);
$loader->register(true);
require_once __DIR__.'/../app/AppKernel.php';
$kernel = new AppKernel('prod', false);
$kernel->loadClassCache();
require_once __DIR__.'/../app/AppCache.php';
$kernel = new AppCache($kernel);
Request::enableHttpMethodParameterOverride();
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);
- Refine - To clarify, the above code refers to the APC cache for classes, this works as described above and in order. what we cannot change are the default namespaces for the ORM APC doctrine entries, they seem to be fixed and thus run into each running instance.
- Update -
Zerrvox , , , . , , , , , , .
appProdProjectContainer .
protected function getDoctrineCache_Providers_Doctrine_Orm_DefaultMetadataCacheService()
{
....
$instance->setNamespace('sf2orm_default_9e755ef08ba52b507455ecd06d0a648985c9593b15aca1522b4725acaaf77ce6');
return $instance;
}
protected function getDoctrineCache_Providers_Doctrine_Orm_DefaultQueryCacheService
protected function getDoctrineCache_Providers_Doctrine_Orm_DefaultResultCacheService