Search code examples
symfonyapc

Multiple Symfony2 Sites using APC Cache


I have two sites using the Symfony2 framework that have similar files.

The sites are both on the same server and use APC cache.

I have noticed that some items that are on one site are then used on another site.

Any APC that has been used have different and unique keys.

Is there some way of splitting the APC cache for each site or set a prefix or something?


Solution

  • Have you tried to use ApcUniversalClassLoader()?

    According to manual, in your autoload.php you can boot APC with different keys:

    require __DIR__.'/../vendor/symfony/src/Symfony/Component/ClassLoader/ApcUniversalClassLoader.php';
    
    $loader = new ApcUniversalClassLoader('your_application_key');
    

    Cheers ;)